- Home /
Loading content after loading scene
Big scenes take some amount of load time. Therefore I want to be able to load some content after the scene is initially loaded. I have a Canvas with a "Loading..." text, and a content panel which is initially deactivated. I want to load the scene, display it to the user and then load the content. Or is the content, when disabled, also loaded on scene creation? I tried with
public GameObject content;
public Text loadingText;
void OnLevelWasLoaded(int level)
{
StartCoroutine(Show());
}
IEnumerator Show()
{
content.SetActive(true);
Destroy(loadingText.gameObject);
yield return null;
}
When testing this on a scene with a few seconds of loading time, it stays at the previous scene until the scene is completely loaded, which is NOT what I want.
A better solution would be to create a "Waiting scene" were you only have your canvas, the message "Loading" and a "Loader" entity which will call the function Scene$$anonymous$$anager.LoadSceneAsync
Then, wait for the end of the loading and make your canvas disappear.