2 Scenes load the same menu at different speeds.

Hi All,

I have a main menu and 2 scenes.
Scene 1 has a terrain, player, and hundreds of objects, including a large object pooler.
Scene 2 is a copy of scene 1.
Scene 2 has nothing in it except a terrain and the player.

Both scenes return to main menu using SceneManager.LoadScene() single. The canvas button is actually a prefab so the code is identical for the button on both scenes.

When the larger scene 1 returns to menu it takes under .2 seconds on editor and on android builds, regardless of what game controller and how many objects are in the scene at any given time.

When scene 2 returns to main menu, it takes 5 to 10 seconds for some reason.

There are no heavy things going on in OnDisable() or OnDestroy() in scene 2. Actually there is nothing at all using those methods.

Can anyone advise how I can troubleshoot this so scene 2 loads the menu nice and fast like scene 1?

Maybe this article will help

I have tested async Loading and it makes no difference,
scene 2 still loads the main menu very slow.

The main menu has nothing except a 2D UI canvas and buttons with images.
I don’t think it is the loading of the main menu, because it consistently loads fast from scene 1 on both editor and android.

It is the unloading of the nearly empty scene, and that makes no sense to me.

Is this occurring on android? If so, see this forum post

Editor, android, and pc builds.

Maybe this post from Andres-Fernandez would help:

I think this could be your problem.

How?

Both of my scenes are loading the same main menu at different speeds.

The larger sized scene loads the main menu fast.
The smaller sized scene takes longer to load the main menu.

What does that have to do with that post? And there is no solution on that post?

I meant that maybe the post would help with troubleshooting. At the start and end of the post it says that the loading and unloading time depended on the other scenes in the build. I dont know, just thought it might be similar to your problem.

Thank you for reading and replying, I do appreciate it.

This was solved magically, and the solution is weirder than the problem. But I will post in case it helps anyone.

I abandoned hope of trying to solve this, and left as “it is what it is” since 2 -5 seconds is not a killer to load a scene, and nothing online worked. I switched platforms to IOS, and made several builds, with no changes to any code or anything in the project aside from build version numbers.

When I changed back to android, all scenes now return to the main menu equally fast at under 1 second. The rapid scene loads are visible on the editor and all platforms. Keep in mind that prior to this, I had already tried build all/reimport all and there was no effect. Very odd, but solved.