How to check if scene exists in SceneManager?
I have this code:
if (Application.CanStreamedLevelBeLoaded(name))
SceneManager.LoadScene(name);
else
StartCoroutine(LoadBundle());
and it works correctly in the editor, but in WebPlayer, it doesn't work. Is there another method to check if scene exists in SceneManager?
Answer by WILEz1975 · Jul 16, 2017 at 11:21 PM
In fact, it's just this simple function: SceneManager.GetSceneByName(myLevelName).IsValid()
for example:
if (!SceneManager.GetSceneByName(myLevelName).IsValid())
{
print("NOSCENE");
return;
}
This only works for cases where the scene is loaded, not if it was from build properties.
Answer by money4honey · Nov 05, 2016 at 11:19 PM
web player is deprecated, it removed in latest version of unity. you may use WebGL instead web player, maybe it solve your problem
Your answer
Follow this Question
Related Questions
Buy Unity Assets 0 Answers
Asset Bundle not compatible between different unity versions 1 Answer
Is Assetbundle.LoadAsset & LoadAllAsset thread safe in Unity5.2.4? 0 Answers
Scene Asset bundle 0 Answers