Пример #1
0
        private void Awake()
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                // Only allow there to be one instance of SceneChanger at a time
                Destroy(gameObject);
            }

            DontDestroyOnLoad(gameObject);
        }
Пример #2
0
 private void Start()
 {
     // In Start because SceneChanger creates itself in its Awake
     sceneChanger = SceneChanger.Instance;
 }