Esempio n. 1
0
 /// <summary>
 /// Creates a instance of this object, if there is an instance already delete the new one
 /// </summary>
 private void Init()
 {
     if (s_Instance == null)
     {
         s_Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance == this)
        {
            Destroy(gameObject);
        }
    }