public static void init() { if (instance == null) { instance = new GameRoot_Test(); } }
public static T getSingleton <T>() where T : Singleton <T> { if (instance == null) { instance = new GameRoot_Test(); } return(null); //return instance.rootObj.GetComponent<T>(); }
public static T addSingleton <T>(GameObject gameObject) where T : Singleton <T> { if (instance == null) { instance = new GameRoot_Test(); } T t = gameObject.AddComponent <T>(); t.Init(); return(t); }
//GameObject rootObj = null; private GameRoot_Test() { //rootObj = new GameObject("GameRoot"); instance = this; }
// Use this for initialization void Start() { GameRoot_Test.init(); }