Beispiel #1
0
        private void OnValidate()
        {
            if (Level == null)
            {
                Level = FindObjectOfType <LevelCreator>();
            }

            if (Player == null)
            {
                Player = FindObjectOfType <PlayerController>();
            }

            if (LevelPosition == null)
            {
                LevelPosition = FindObjectOfType <LevelPositionController>();
            }

            if (GameUI == null)
            {
                GameUI = FindObjectOfType <GameUIManager>();
            }

            if (ResourcesProvider == null)
            {
                ResourcesProvider = FindObjectOfType <GameResourcesProvider>();
            }
        }
 private void Awake()
 {
     if (singleton == null)
     {
         singleton = this;
     }
     else if (singleton != this)
     {
         Destroy(gameObject);
     }
 }