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