Question by
jvogt · Sep 12, 2016 at 11:23 AM ·
scripting problemscene-loadingscene loadevent-handling
SceneManager.sceneLoaded returns scene.isLoaded as false, is this intended?
i'm adding a delegate to Scenemanager.sceneLoaded and try to load a scene, whoch works fine so far.
SceneManager.sceneLoaded += OnSceneLoaded;
SceneManager.LoadSceneAsync(name, LoadSceneMode.Additive);
but if i want to do something with the scene in the callback function, for example
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
Debug.Log(scene.GetRootGameObjects().Length);
}
it will throw an exception "ArgumentException: The scene is not loaded.".
scene.isLoaded is in fact false at this point, as it gets set to true in the next frame i assume?
is this intended behaviour of the scene? i'd really like to do stuff with the scene when its loaded, it seems useless to have a sceneLoaded event when the scene is not marked as loaded.
Comment
Yeah, I'm seeing this as well (in 5.5), did you ever get it figured out?
Answer by molson · Feb 23, 2017 at 05:49 AM
I'm getting this too in 5.5. Did you ever figure it out?