- Home /
Is there any ideas to load Unity scene asynchronously?
Actually I know how to load scene asynchronously with using SceneManager.LoadSceneAsync(), but it cannot handle stopping situation while loading some scenes which has a lot of resources.
It seems that some loading procedure occurs after asyncLoad.isDone to initialize a lot of resources.
I want to show some specific loading progress view (like "loading..." text with cute animations) until this resource-loading procedure was finally done.
And I found that SceneManager.sceneloaded is called after resource-loading procedure.
Is there any ideas to solve this problem?
Thanks in advance.
I have also same issue from couple of days anyone have solution for this so please reply. crediblebh
Answer by rh_galaxy · Dec 02, 2021 at 02:14 AM
I think you will be disappointed, it can't be done fully smooth without losing frames. Both because the async load isn't fully async and because it needs to do more work when "completed", and also all of your own Awake() and Start() functions need to run all at one frames time.
You can try to do your init/loading in Update() and chop it up into say 7ms chunks, and set Time.timeScale = 0 until you are ready, but you may end up like me with uglier code and still not working ok.
I was working on a VR-game where 90 FPS must be achieved, I ended up fading screen to all black, do all loading, then fade in, to hide the choppiness.
You can also see with the frame profiler that it is impossible to do all frames in 11.1ms (in my case for 90Hz), since things outside of your control takes longer at the actual scene switch. But if you accept a certain amount of choppiness/uneven frame rate maybe a loading progress indicator can be made working. But for a VR-game where stuttering is unacceptable it is better to fade to black in Unity.
Glad to help even if it didn't solve the problem.
Right. People have already asked for a pure grouping mechanic inside a scene that doesn't involve empty gameobjects. If Unity may come up with a solid grouping concept that will be interleaved with the normal hierarchy, we could get some sort of chunk loading support where we could assign a priority or time delay to certain groups so when the scene loads it would "activate" those chunks in that order / with those specified time delays. You as the developer would still be in charge of making sure such a loading delay makes sense from a conceptional point of view. Any automatic process would be doomed to fail as developers could do all sorts of things that are not compatible with splitting a scene up.
Currently if you have large scenes the only viable solution is to manually split them up into smaller additive scenes which would represent your "scene sections". So you are responsible for loading and activating them in a way / order that makes sense for your game.
There are already some solutions that may help with the organisation of those scenes in the editor like those scene groups.
Your answer
Follow this Question
Related Questions
Most efficient way to transition between scenes? 1 Answer
Unity Scene loading problem (slow loading until it freezes) 0 Answers
Load Scene from .unity File 1 Answer
Re-loading a scene but on the background older scenes are displayed 1 Answer
UnloadSceneAsync() does not seem to work with additive scenes. 1 Answer