Hi!
I stumbled upon a bug that causes a scene, that was supposed to only preload ("Don't change scene, just preload data?" checked), to load / switch to it.
This happens if the scene action is called immediately in the OnStart actionList with no delay. If I add a delay it just preloads normally.
This bug occurs for any scene name entered.
As I would really much like to use this feature I browsed the code a bit and found no clear reasons to why this is happening.
Could this perhaps be a Unity cause?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Versions:
AC 1.71.2
Unity 2019.3.9
I can't recreate such behaviour. This may well be a Unity quirk.
What are your "Scene loading" properties in the Settings Manager set to? And are you beginning the game from this first scene (the one with the Action), or switching to it from another? If switching, what from - the scene you're preloading?
Those are my properties: https://prnt.sc/ss9p65
I am beginning the game from this scene, no switching from any other.
Also, if I start the game in pause, the switch still occurs.
This is the OnStart actionList: https://prnt.sc/ss9rnw
Thanks for the details, though I'm still not able to recreate it.
Does a wait time of -1 (which causes a single-frame delay) also fix it?
Sorry, how do you mean?
Setting the delay to -1 or even to 0.01 doesn't seem to be long enough, but 0.1 is.
If I click on the Pause button in Unity editor before I hit Play to enter play mode, the scene switch also happens, even though I am still in pause mode.
I will attempt a build to see if it might be just a bug with the editor.
Yes, determining if this is an Editor-only issue would be the next step.
This might be an editor only bug after all.
I've set the wait to zero and build the game. No scene switching at all!
What's weird is that I've found no posts elsewhere about this issue.
I think that if I set a 0.1 delay (as before) it should be okay for the editor. What do you think?
I can't recreate it on my end. It may even be unique to your project / circumstance, somehow.
If 0.1 works but not -1 (i.e. a single frame), it sounds like it's a timed issue. Might want to double it to 0.2 just to be safe.
I can confirm this is happening but it is probably a unity issue
as mentioned, I am simply adding a unity engine wait 0.1 for preloading onstart
unity ignores allow scene activation tag on awake
https://issuetracker.unity3d.com/issues/loadsceneasync-allowsceneactivation-flag-is-ignored-in-awake?_ga=2.97380575.1504415196.1591642224-637722007.1578579941