public IEnumerator LoadGameScene()
{
yield return new WaitForSeconds(2);
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneToOpen);
asyncLoad.allowSceneActivation = false;
while (!asyncLoad.isDone)
{
float progress = Mathf.Clamp01(asyncLoad.progress / 0.9f);
Debug.Log("Loading progress: " + progress * 100 + "%");
if (asyncLoad.progress >= 0.9f)
{
Debug.Log("Scene almost done loading...");
asyncLoad.allowSceneActivation = true;
}
yield return null; // Wait until the next frame to check again
}
Debug.Log("Scene loaded successfully!");
}
The code runs but never gets past 0% loaded for whatever reason.