Load scene without lag

Hello!
When I load a scene (also when the game loads the first scene) I notice a lot of lag in the music and graphics.
Is there a way to handle scene loading without making the game freeze while loading?

My PC has an Intel I7 4.2GHz, 16GB of RAM and a GTX 960 4GB

Thanks a lot

Sounds like you need to profile your game and see what is creating the lag. If it really is music and graphics, then you’ll need to see what files are creating the problem and see what you can do to those files to help them.

You may need to load your scene async so it loads while you’re in your current scene, but unless you profile the game, we can only guess what is creating your lag. With your current info, we can only guess what may help you.

Thanks :slight_smile:

I’m trying to use the profiler and when the scene changes the game freezes, music lags and also the editor freezes until the level is loaded.

Do you know how can I profile my game in the right way? Thanks for the help

If you’re using the profiler window, even though the editor is frozen during the frame, it’ll create a clear “blip” on the line graph; if you click on that blip you’ll be able to see what was taking up so much time.

Amazing! I finally found that the extreme lag was caused by the SteamAPI initialization that I called on every scene start. Now I instantiate it only in the first scene and I use the DontDestroyOnLoad to maintain it instantiated.
Thanks to the profiler and your help :slight_smile:

1 Like

Profiling is amazing that way :slight_smile: Glad it worked out so straightforwardly for you.

Glad it worked out for you and wasn’t anything complex to fix.