예제 #1
0
    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);
    }
예제 #2
0
 // Use this for initialization
 void Awake()
 {
     singletonStarInstance  = SingletonStar.getInstance();
     singletonHeartInstance = SingletonHeart.getInstance();
 }
예제 #3
0
 void Awake()
 {
     _singleton = SingletonStar.getInstance();
 }