How to tell when additive scene is activated?

I’ve searched and read dozens of posts and still can’t get this to work.

I have a main scene with my menus etc.
I then load a gameplay scene additive.

I simply want to hook into an event after the scene is loaded and active.

Everything I have read and tested shows the scene as still loading in the hierarchy.

The main thing I’m trying to accomplish is instantiating objects in my gameplay scene after it is activated.

I have an Init() method I want to call that will do the instantiating, but I can’t figure out how to call that method after the scene is actually activated. Everything I’ve come across so far just deals with how to tell when it is loaded, which is not the same as activated.

Parenting instantiated objects to some predefined gameobject in the newscene is not acceptable.
Instantiated objects need to show in the active scene, which needs to be the newly loaded additive scene.

You need to set the active scene to the new scene. Then it will be “activated”.

private void StartLoadingEncounterScene() {
    SceneManager.sceneLoaded += WhenEncounterSceneLoaded;
    SceneManager.LoadSceneAsync("Encounter", LoadSceneMode.Additive);
}

private void WhenEncounterSceneLoaded(Scene scene, LoadSceneMode mode) {
    SceneManager.sceneLoaded -= WhenEncounterSceneLoaded;
    SceneManager.SetActiveScene(scene);
    // Now you can call Init because the scene is active
}
1 Like

Seems to do the trick, thanks!