public static SingletonStar getInstance() { if (_instance == null) { _instance = GameObject.FindObjectOfType <SingletonStar>(); } /* * if(_instance == null) * { * Debug.LogError("An instance of Singleton is needed in the scene, but there's none."); * } */ if (_instance == null) { GameObject go = new GameObject("SingletonStar"); _instance = go.AddComponent <SingletonStar>(); } return(_instance); }
// Use this for initialization void Awake() { singletonStarInstance = SingletonStar.getInstance(); singletonHeartInstance = SingletonHeart.getInstance(); }
void Awake() { _singleton = SingletonStar.getInstance(); }