During my work on a my personal project i got stuck on a problem that regards the async load of a scene…
preloading assets asynchronously before scene activation.
My idea would be something like to trigger, after the call of SceneManager.LoadSceneAsync in LoadSceneMode.Single mode, once reached the famous value of 0.9 in progress, a callback on every MonoBehaviour of the new loaded scene or at least make available the result of loadedSscene.GetRootGameObjects() in order to allow the programmer to operate in his favorite ways on them.
It would be great if the call in the MonoBehaviour was a coroutine, as the Start Method in order to allow other async operations.
What are you trying to achieve with this? And wouldn’t these callbacks be invoked even before Awake() and OnActivate()? I think it would make more sense to delay starting the scene until after your controller gives the go after the entire scene has loaded, all scripts are initialized and your special activation method has been invoked. In case you haven’t already, look at SceneManager’s OnSceneLoaded.
Well the problem with SceneManager.onSceneLoaded is that is called only after scene activation, and its late in that moment because the scene and all its objects are activated.
My proposal would be a callback or delegate called just when the scene loading progress reach the 0.9 progress, in this way other async loading processes could be done using coroutines and at whose end the scene can be activated manually by the programmer.