//--------------------------------------------------------------------------------------------/ // Static Methods //--------------------------------------------------------------------------------------------/ /// <summary> /// Instantiates this behaviour at runtime, adding it to the managed behaviour system /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static T Instantiate <T>() where T : ManagedBehaviour { T behaviour = Instantiate <T>(); ManagedBehaviourSystem.Add(behaviour); return(behaviour); }
/// <summary> /// Destroys this behaviour, removing it from the managed behaviour system /// </summary> /// <typeparam name="T"></typeparam> /// <param name="behaviour"></param> public static void Destroy <T>(T behaviour) where T : ManagedBehaviour { ManagedBehaviourSystem.Remove(behaviour); Destroy(behaviour); }
private void OnDestroy() { ManagedBehaviourSystem.Remove(this); this.OnManagedDestroy(); }
//--------------------------------------------------------------------------------------------/ // Methods //--------------------------------------------------------------------------------------------/ private void Awake() { ManagedBehaviourSystem.Add(this); this.OnManagedAwake(); }