I am getting an error that says:
Coroutine couldn’t be started because the the game object ‘MainMenuObject’ is inactive!
However, that object is not inactive. It is active in the editor, it is never rendered inactive by my scripts, actually never referenced by them, and the editor itself tells me it’s active, unless there is something that I fundamentally do not understand here.
In the script I have the following 3 lines of code:
- Debug.Log(GameObject.Find(“MainMenuObject”).activeSelf);
- Debug.Log(GameObject.Find(“MainMenuObject”).activeInHierarchy);
-
- WaitAndLoadLevel(4, 0);
This gives in the console:
- True
- UnityEngine.Debug:Log(Object)
- MainMenuButton:OnClickEscapeYesButton()(at Assets/Scripts/MainMenuButton.js:81)
- UnityEngine.EventSystems.EventSystem:Update()
- True
- UnityEngine.Debug:Log(Object)
- MainMenuButton:OnClickEscapeYesButton()(at Assets/Scripts/MainMenuButton.js:82)
- UnityEngine.EventSystems.EventSystem:Update()
- Coroutine couldn’t be started because the the game object ‘MainMenuObject’ is inactive!
- UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
- MainMenuButton:OnClickEscapeYesButton() (at Assets/Scripts/MainMenuButton.js:84)
- UnityEngine.EventSystems.EventSystem:Update()
I wonder if this error can be caused by something else?
Is there some secret code that is executed between my 3 lines of code that deactivate the MainMenuObject ?