void Start() { //Find references toolbox = FindObjectOfType <Core_Toolbox>(); if (toolbox == null) { Debug.LogError("toolbox not found!!!"); } em = toolbox.GetComponent <Core_EventManager>(); gameManager = toolbox.GetComponent <Core_GameManager>(); Transform respawnPointHolder = transform. GetComponentInChildren <Core_RespawnPointHolderTag>().transform; foreach (Transform child in respawnPointHolder) { respawnPoints.Add(child); } //Find globalVariableLibrary and get variables from it lib = toolbox.GetComponent <Core_GlobalVariableLibrary>(); GetStats(); //Send respawnPoint list to GameManager and broadcast NewSceneLoaded gameManager.SetRespawnPoints(respawnPoints); em.BroadcastNewSceneLoaded(mySceneIndex); }
void Awake() { #region Singletonization if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); #endregion toolbox = FindObjectOfType <Core_Toolbox>(); em = toolbox.GetComponent <Core_EventManager>(); lib = toolbox.GetComponent <Core_GlobalVariableLibrary>(); GetStats(); }