AssetBundle and LoadedLevelName : How to replace it ?

Hi,

I’m using AssetBundle and I got headache not using Application.LoadedLevelName anymore. Because when you use scene from asset bundle, Application.LoadedLevelName is empty (for reason, I don’t wanna dig in it :smile:)

Can someone have a solution ?

Because if i set a string BEFORE the loading : It’s not ok, if something go at the same frame, it can detect he’s not on the right scene.
If i set a string AFTER the loading, it miss the OnLevelWasLoaded() and Awake() function of the script in the loaded scene, because the loading wait of “isDone” in a coroutine, which is called after all of these functions.
I set the string during the OnLevelWasLoaded of my loader : you lose again, cause OnLevelWasLoaded() doesn’t seems to be called by order define in Script Execution Order, so it can miss some script.

How can I replace Application.LoadedLevelName with a 100% secure solution ?

Thanks a lot !

Sorry for bumping this.

If still no one have an idea after this bump, i’ll go to Unity Answer even if this is typicaly the kind of question no one answer on it. :frowning:

So which version of Unity are you using? Could you open a bug with description of what exactly you’re doing?

Hi, we’re using 5.2.3p2, but what is the bug you are talking about because I don’t know what is the wrong behavior :

Does Application.LoadedLevelName should be filled even if you use Asset Bundles ?
Or is the OnLevelWasLoaded order execution ?

I thought it was the normal behavior, was just asking for a workaround. Thanks !

Yoops, update : I just figure that only happens with AssetsBundleManager in “Simulation mode”.

Everything works fine if you’re not in simulation mode. Do I still report a bug (since it’s a bug in an officiel Asset Store plugin and not in Unity ?)