private string defaultErrMsg = "Missing scene json file: <>. Check the file name and directory again."; // error message to be displayed on canvas private void Awake() { // Obtain current scene name and locate the correct json file; set default error message string currentSceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.ToLower(); sceneJsonFile = "voiceovers_" + currentSceneName + ".json"; //sceneJsonFile = "voiceovers_bluewhale.json"; defaultErrMsg = defaultErrMsg.Insert(defaultErrMsg.IndexOf(':') + 3, sceneJsonFile); instance = this; // assign audio source for voiceovers if (!audioSource) { audioSource = GetComponent <AudioSource>(); if (!audioSource) { audioSource = gameObject.AddComponent <AudioSource>(); } } if (sceneJsonFile != null) { InitializeVoiceoverManager(); } }
private void OnDestroy() { instance = null; }