Massive lag when changing scenes.

I am making an endless game in unity 2d. The screen layout resembles flappy bird, and as such has obstacles, your score, you, and your controls. The main menu is part of the same unity scene and appears when the app starts and when you die. You can buy characters, which are just sprite changes in the shop. The shop is in a separate scene. The scene change was just fine, but after adding music to both scenes, and more costumes, it takes 8 seconds to go from menu to shop. 12 seconds to go back to menu. Switching to the credits scene is instantaneous, but going back takes 6 seconds. This doesn’t seem like much, but I’m sure users will find it unacceptable. How do I fix this?

You’ll need to use the profiler to find out what is using up all the resources and taking so long.

I only ever have this problem if I have procedurally generated meshes and they’re still unbaked (have to be regenerated every scene load).

You may have something similar going on. Not meshes specifically but might be computationally heavy things happening on Start or Awake. You may also be unnecessarily loading and unloading resources all the time.

But yeah, Profiler will take some of the guesswork out. There was a recent official tutorial video about it for beginners if you don’t know how to use it yet.

I solved it. I didn’t realize there was unity answers and posted to it afterwards. I just moved everything to the same scene and set the active status of canvases. It takes longer to start up, but it’s better than loading the scenes over and over again. I think this is how crossy road did it.

How can i permanently destroy an gameobject when i reload a scene, what I want is when i press start game , the button “start” permanently destroy in the hierarchy. But whenever I reload a scene its still there… any tips on how to do that?

same as flappy bird restart button, excluding the start button