public static void AddPrefabCheck(string key, GameObject gO)
 {
     if (!SpawningPool.ContainsPrefab(key))
     {
         SpawningPool.AddPrefab(key, gO);
     }
 }
Exemplo n.º 2
0
 private void Awake()
 {
     if (awake)
     {
         return;
     }
     else if (instance == null)
     {
         awake    = true;
         instance = this;
         DontDestroyOnLoad(this);
         if (Prefabs != null)
         {
             foreach (var prefab in Prefabs)
             {
                 SpawningPool.AddPrefab(prefab.Key, prefab.Prefab);
             }
         }
         UnityEngine.SceneManagement.SceneManager.sceneLoaded += SceneWasLoaded;
     }
     else
     {
         Object.Destroy(gameObject);
     }
 }