I upgraded my unity project to 2018.3.11f. Since that upgrade, the OnSceneLoaded event is not getting called, even though I am registering the event handler.

Here's the class:

public class SceneSwitcher : MonoBehaviour
{
{
}

void Start()
{
print("SceneSwitcher.Start() called");
}
}


here's the console output:

SceneSwitcher.Start() called
UnityEngine.MonoBehaviour:print(Object)
SceneSwitcher:Start() (at Assets/Scripts/SceneSwitcher.cs:45)
UnityEngine.MonoBehaviour:print(Object)
SceneSwitcher:Start() (at Assets/Scripts/SceneSwitcher.cs:46)


scene loaded: 3 is never in the console output.

This code worked before the upgrade. Now I am stuck. Not sure what I can do. Any help is appreciated.

Thnx

• perhaps because in the snippet you show, there is no changing of scene request – BugFinder Apr 5 '19 at 9:55
• I moved the code from Start() to Awake(). Now it works. It seems like order of events behind the scenes might have changed or something. I will post this as the answer. If someone can help me understand why that changed worked, that would be great. (to verify my change worked, I moved it back to Start() and the sceneloaded event was not called). Awake() is the correct place for this now. – tatmanblue Apr 5 '19 at 14:02
• @BugFinder fair point. I am switching scenes (and I believe before the upgrade the event was called even during my first scene). I do not know how to "prove" that concisely enough. If you have a suggestion what else to include, I am happy to add it. – tatmanblue Apr 5 '19 at 14:23
• All i can say is code order is a thing. – BugFinder Apr 6 '19 at 1:25