예제 #1
0
 void OnDestroy()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
예제 #2
0
    void Awake()
    {
        if (_instance != null)
        {
            Debug.LogError("DailyBonusManager: detected singleton instance has existed. Destroy this one " + gameObject.name);
            Destroy(this);
            return;
        }

        _instance = this;
    }
예제 #3
0
    // to be sure that not more that one instance of manager will be on scene
    void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
            return;
        }
        _instance = this;

        DontDestroyOnLoad(gameObject);

        //PlayerPrefs.DeleteAll();

        // Be Sure to not parse empty string
        if (PlayerPrefs.GetString("DateOfLastPlayed") == String.Empty)
        {
            Debug.Log("First Data Initialization");
            PlayerPrefs.SetString("DateOfLastPlayed", DateTime.Now.ToString());
        }
    }