Example #1
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Example #2
0
 void Awake()
 {
     // verify if instance already initialized
     if (Instance == null)
     {
         // prevent this game object (game options) to be destroyed on scenes change
         // this only works on root objects in a scene, so disabled for now
         // DontDestroyOnLoad(gameObject);
         // initialize instance with this game object
         Instance = this;
     }
     // verify if instance were instantiated by some other scene, when there is already instance present
     else if (Instance != this)
     {
         // destroy this instance of game options to keep only one instance
         Destroy(gameObject);
     }
 }
Example #3
0
    protected char whoMoves; //a = igrac A; b = igrac B

    void Awake()
    {
        instance = this;
    }