Title says it all, im trying to optimize my loading of scenes and i can take up to 9 seconds to load a scene sometimes and other times less than 3 seconds, im trying to pinpoint what needs to be optimized but profiling this is a lot more challenging that i thought. also noticed that once a scene has been loaded once re entering it yields a much quicker load time even if the game has been restarted which i find quite puzzling.
so where should i start?
I am going out on a limb here and say that you have too much stuff referenced directly by your scene that gets all pulled and loaded before the game has a chance to start.
You can verify that assumption by right-clicking your scene in the editor and choose “Select Dependencies”.
If that brings up like 1000 textures and 500 audio files, then you got yourself a problem. ^^.
AFAIK, Unity preloads almost everything that is directly linked in a scene file and which is not in an asset bundle. So if that is your problem, you might try one of the following:
- Clean up all unused links. (maybe you just forgot to remove some big resources from test-objects that are deactivated anyway…?)
- Set big audio clips like background music to streaming.
- Pack stuff that you don’t need right at the start of the game in Asset Bundles and load them asynchronously
- Move stuff in other scenes and load them asynchronously (and additive).
- Move stuff to Resources/ folder and load them via code once the game started
Well, of course it could be that the problem is totally somewhere else. You know… stuff like “void Awake() { Thread.Wait(1000); }”.