Extending MonoBehaviour

Extending the functionality of Unity's MonoBehaviour is quite easy. Just derive a class MyBehaviour from MonoBehaviour and derive all other behaviours from MyBehaviour.

Example
using UnityEngine; using System.Diagnostics;

public class MyBehaviour : MonoBehaviour {

protected void info(string text) {

string nameOfCallingMethod = GetType.Name + "."; StackTrace callStack = new StackTrace; nameOfCallingMethod += callStack.GetFrame(1).GetMethod.Name;

if(text != "")

// .. or something similar ResourceManager.Log.Info(nameOfCallingMethod + ": " + text);

else

// .. or something similar ResourceManager.Log.Info(nameOfCallingMethod); } }