private void Awake() { audioManagerSoundEffects = FindObjectOfType <AudioManagerSoundEffects>(); audioManagerAmbient = FindObjectOfType <AudioManagerAmbientMusic>(); gameStateManager = FindObjectOfType <GameStateManager>(); if (gameStateManager != null) { //gameStateManager.UnPauseGame(); } }
// Start is called before the first frame update void Awake() { audioManagerSoundEffects = FindObjectOfType <AudioManagerSoundEffects>(); if (audioManagerSoundEffects == null) { Debug.LogError("Sound Effects Manager not found [ButtonScript]."); } cursorManager = FindObjectOfType <CursorManager>(); if (cursorManager == null) { Debug.LogError("CursorManager not found [ButtonScript]."); } //I added this line to check if the game loads faster with direct assignment or not if (takesFocus == null || losesFocus == null || confirmOnClick == null || cancelOnClick == null) { AudioClip[] soundEffects = UnityEngine.Resources.LoadAll <AudioClip>("Audio\\Sounds\\UI SoundEffects\\ButtonSounds"); takesFocus = soundEffects[0]; losesFocus = soundEffects[1]; confirmOnClick = soundEffects[2]; cancelOnClick = soundEffects[3]; } }