Commit 8d13b79d authored by Tanner Grehawick's avatar Tanner Grehawick
Browse files

add SingletonBehaviour usage example

parent df4aa5ac
......@@ -21,3 +21,30 @@ public abstract class SingletonBehaviour<T> : MonoBehaviour where T : SingletonB
}
}
}
/* Usage example
// SomeManager.cs:
// A singleton script that manages something
public class SomeManager : SingletonBehaviour<SomeManager> {
public void DoSomething(MonoBehaviour someScript) {
// some code here, just like any other behaviour might have
}
}
// SomeNormalScript.cs:
// A normal script that needs to access the single instance of SomeManager that should be present
// in the scene
public class SomeNormalScript : MonoBehaviour {
void Awake() {
SomeManager.instance.DoSomething(this);
}
// more behaviour code
}
*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment