MrDude
1
I am trying to see if a scene is already loaded before I additively load it again thus either setting it active or loading it if it doesn’t exist. So I am running into this problem:
Scene already_loaded = SceneManager.GetSceneByName(scene_name);
if (null != already_loaded)
{
Debug.Log(already_loaded.name);
SceneManager.SetActiveScene(already_loaded);
return true;
}
return false;
That prints off the scene name as “Null” and then throws a runtime exception when I try to set the scene to active. So how in the world do I test if the results are invalid if not via a null test?
Right now I am using this:
if (already_loaded.name != null)
…but surely there HAS to be a better way to test if a scene is valid or not!
So my question is simply this: What Is that way?
MrDude
2
Oh…
The scene has an IsValid() function… Ahhh… Okay. Never mind my n00b moment, please 