Search Issue Tracker

Fixed in 5.4.1

Votes

0

Found in

5.4.0b4

Issue ID

767792

Regression

No

SceneManager.onSceneLoaded not called on the first frame when added in RuntimeInitializeLoadType.BeforeSceneLoad

Asset Loading

-

Reproduction steps:
1) Open project "LoadEventBug"
2) Open scene "Demo"
3) Play the scene.
--- Note that "init" is logged to the console.
--- Note that "loaded" is not.
--- This is despite the Init function supposedly being called before the onSceneLoaded event is fired

Code:

public class Test : MonoBehaviour
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Init()
{
Debug.Log("init");
SceneManager.sceneLoaded += LevelWasLoaded;
}

private static void LevelWasLoaded(Scene scene, LoadSceneMode mode)
{
Debug.Log("loaded");
}
}

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.