PrintExtended

From Unify Community Wiki
Jump to: navigation, search


Author: Jake Bayer (BakuJake14)

Contents

Description

Additional methods that go with the print function.

Usage

Works the same way as the print function that inherits from MonoBehaviour.

Printing a warning

	public void TestExample() {
		float dist = Vector3.Distance(transform.position, light.transform.position);
 
		if(dist < 3) {
			PrintExtended.printWarning("my position from the light is " + dist);
		}
	}

Printing an error

	public void FollowAI() {
		Transform target = transform.parent.transform;
 
		if(target == null) {
			PrintExtended.printError(target.name + " could not be found");
		}
	}

PrintExtended.cs

using UnityEngine;
using System.Collections;
 
public class PrintExtended : MonoBehaviour {
 
	public static void printWarning(object message) {
		Debug.LogWarning(message);
	}
	public static void printError(object message) {
		Debug.LogError(message);
	}
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox