- Home /
Checking if arbitrary level is loaded
Is there any function that will allow me to do something like this?
while(!isLevelLoaded("MyLevel")) yield return WaitForNextFrame();
Using Application.loadedLevelName is unsafe if I'm loaded multiple levels at the same time.
How do you load multiple levels concurrently ? Perhaps you should add a persistent object that can live through level-client travels; that way you can save the level you PLAN ON loading beforehand in a variable on the object, then scan for the object and see what you stored in it after a level change and a client travels ? Just a quick thought. Perhaps some example code and a bit of more explanation might be necessary. GameObject.DontDestroyOnLoad() might help, but it's just a guess. You might need client replication so serialization over a network would be needed if you want the client to know too.