- Home /
Scene Loading Very Slow - Sometimes
Sorry this is a bit vague, but I can provide more details if needed. I wanted to put the scenario out there first to see if anyone has any ideas. As part of creating a new game I have two scenes - a Main Menu and a prototype level scene. I have UI buttons in each that allow me to navigate between them just fine with no delay. Recently I added a new scene that will serve as a level selection. It is an empty level (no meshes, lights, etc) with a single button - a Back button to return to the main menu. It uses the same code in its button to load the main menu as the prototype scene. If I run it so the Main Menu scene goes to the new scene it works fine. However, the button on the new scene to load the Main Menu scene takes 15 seconds for the Main Menu scene to load. The oddness is that I can go from my prototype level scene back to the Main Menu scene in about 1-2 seconds. I'm at a loss as to how it can take so much longer to go from a basically empty scene to the Main Menu scene when a fairly heavy scene does it without any issues.
I suspect that I have isolated the issue, but I only have a theory for why it would go from one scene just fine and not another. In the end I decided there were too many textures being loaded on the main menu. I've confirmed that I can get it to load much faster by reducing the number of them.
For the theory part, I wonder if the reason that it goes from a heavy display to the main menu has to do with them having many textures in common. If they are already in memory, will it use them versus loading them? Not sure.
Are you sure you are not using any shader which takes time to load?
I've confirmed that it is a contributing factor. Initially, I created a background for the problematic scene with some of the game assets (houses, etc) included. If I remove all of them, it improves the load time. $$anonymous$$y plans are to switch to a static image or sprites as the background. It's not exactly how I pictured the end-result, but it should do. Thank you for the feedback.
Answer by tormentoarmagedoom · Mar 13, 2018 at 11:13 AM
Gooda day. Do your scene have music and sounds? you must know preloading or not all music and sound make the loading process very slow.
You should take a look at the Unity audio source page and compile your project in diferent audio configurations to see which way is the best for you.
Regards!
If helped, accept the answer! :D
That's very good to know. I'll try removing all of the sounds to see if it helps. Thanks for the info.
I changed a few things and now have it loading in a little over a second. The biggest boost was in changing the audio settings per this post.
As such, I've accepted your answer. It is worth noting that using $$anonymous$$eshBaker to combine meshes/materials and updating my texture compression settings also helped.
Thank You. I just changed the decompress type to strea$$anonymous$$g for all audio files in my game and also unchecked pre-loading. the scenes load faster now.
Your answer
Follow this Question
Related Questions
Does scene loading improve performance? 1 Answer
Webplayer hangs on loading scene 2 Answers
Game flashes to white and desktop while changing scenes 2 Answers
What Happens in Scene Load 1 Answer