After building an asset bundle for a scene using BuildPipeline.BuildStreamedSceneAssetBundle() I can load the scene from the bundle just fine using Application.LoadLevel(). However, Application.LoadedLevelName is an empty string. This doesn’t seem right to me.
I can understand Application.LoadedLevel being -1 (the value it returns for a scene loaded from an asset bundle), but since the scene was loaded using its name, it baffles me that Application.LoadedLevelName should be empty. Am I missing something? Is this a bug? or is it intended behavior?
I’ve tried searching here and various other sites and haven’t managed to find anything dealing with these variables directly when loading scenes from an asset bundle. I know I can write my own wrapper for loading levels and tracking the name, but I’d prefer to utilize the built in functionality of Unity as much as possible.
Thanks!
This does in fact seem to be a bug, at least non-intuitive behavior. I ran into the same problem and was able to work around it by storing the string name of the scene I loaded in a separate variable. I was able to load the level using this variable as the parameter but not with LoadedLevelName. For some reason LoadedLevelName is not being populated with the name from the scene loaded via an Asset Bundle.
– figs999