Пример #1
0
 // Use this for initialization
 void Start()
 {
     if (Instance != null)
     {
         GameObject.Destroy(gameObject);
     }
     else
     {
         GameObject.DontDestroyOnLoad(gameObject);
         Instance = this;
     }
 }
Пример #2
0
 private void Awake()
 {
     //Check if only one in scene
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         //already one in scene
         Destroy(gameObject);
     }
 }
Пример #3
0
    void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            instance = this;
        }
        else if (instance != null)
        {
            Destroy(gameObject);
        }

        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }

        if (stairArray.Length == 0)
        {
            stairArray = GameObject.FindGameObjectsWithTag("Stair");
        }
    }
Пример #4
0
 void Awake()
 {
     Instance = this;
 }