How to Debug LoadSceneAsync? Game freezes when trying to LoadSceneAsync. Profiler says "Editor Overhead"
So I'm using LoadSceneAsync in my game and when it loads the level everything freezes for the entire frame that it loads on Windows and Linux Standalone player.
Here is the basic code for the load: This is called within a different Coroutine like this:
Now this is only intended to load the Scene 90% of the way, and the rest will be loaded later - which is the whole purpose of setting "allowSceneActivation" to false
Now here is the profiler for the frame where the Spike happens:
The Timeline seems to show that the "PreloadManager" is where the bulk of the spike takes place - but it is Not clear what thread this is happening on and the MainThread simply shows "EditorOverhead"
The Hierarchy view is no help at all, as it only shows the editor as the culprit for the 2500ms Lag spike: This is with Deep Profiling enabled - and its the same without it.
I've tested out various different settings such as these: Application.backgroundLoadingPriority = ThreadPriority.Low;
AsyncOperation.priority = 10; (used on the asyncOp var above)
I've also read a few other questions with people who had similar issues, some have suggested the following:
LoadSceneAsync freezes the editor when loading scenes with a lot of gameobjects (but I only load up to 90%)
Trying to LoadAsync from Awake or Start will put it on the main thread.
Questions:
Is this a know issue with LoadSceneAsync - where Large scenes will still cause Lag spikes?
How can I check which Thread the level is loading on? or is it Split up between the Main thread and the background thread - and I have not control??
Thank you!
Your answer
![](https://koobas.hobune.stream/wayback/20220612161848im_/https://answers.unity.com/themes/thub/images/avi.jpg)