#How does unity handle scene second load?

1 messages · Page 1 of 1 (latest)

ruby wigeon
#

The first time I load a scene everything work perfectly fine as intended. However the second time the scene is loaded (going to menu and back), even if the reference are set to work and the debug.log still triggers, all my timelines, animations, awake(), audios basicaly everything doesn't work anymore. I was suggested to manualy reset some values as to unity might not handle it so I did stop my coroutine and reset animations etc... but im still having this issues, Any insight as to how im suppose to handle this?

spice vine
#

Are you using singletons? Or any other static variables that needs to be reset.

ruby wigeon
#

nop

torpid jewel
#

could use some screenshots about how your scene is setup

spice vine
ruby wigeon
#

Ok ill send screenshot when i wake up , as to don’t destroy i haven’t use that yet on anything

spice vine
#

Also send SS of the bugged code =) or code that won't be called

ruby wigeon
#

well there isnt a specific line of code that is bugged its like the whole scene

#

im using SceneManager.LoadScene()

#

or if you want an exemple this coroutine works the first time the scene is loaded but not the second time (this coroutine is not in the video but its a transition fade in the menu) :

#

which is a monobehaivour inside one of the ui elements

spice vine
#

I can’t have a close look rn, but I’d get up some Debug.Logs to check what gets called or not.

ruby wigeon
#

I think it has to do with the references, cause the code does run inside the coroutine and inside the loop, but it stays inside without ever changing the value of " color" it stays at 1 and doesnt fade, and therefor never ends.

ruby wigeon
#

Upon further investigation I Log my variable delta (time.deltatime) and the second time the scene is loaded it stays at 0, aka the game is frozen

#

So the solution was my pause menu that was redirecting to menu stops my game by setting time scale to 0, but never back to 1 when leaving.