Hello, I am trying to create a loading screen using LoadSceneAsync, however I seem to be getting some issues.
I have three scenes, main menu, the loading scene and the main scene. Currently the main scene has a button which when clicked calls a function that just calls the next seen to be loaded. However this change from main menu to the loading screen seems to be taking longer to load than the loading to game scene, even though the loading scene is basically empty. So it goes main menu, a slight freeze, loading scene for a split second and then into the game. It feels like that when the main menu calls the loading scene to load, it waits until that has also loaded the main game scene. The code for this is below could anyone please help me with where I may be going wrong with this
main menu - changeScenes is called by the button press.
void Start()
{
}
public void changeScenes()
{
Debug.Log("change scenes");
SceneManager.LoadScene(1);
}
the loading scene
void Start()
{
StartCoroutine(loadScenes());
Debug.Log("loading scenes script");
}
IEnumerator loadScenes()
{
AsyncOperation loadMainScene = SceneManager.LoadSceneAsync(2);
//loadMainScene.allowSceneActivation = false;
while(loadMainScene.progress < 1)
{
yield return new WaitForEndOfFrame();
}
}