PhotonNetwork.LevelLoadingProgress Unexpected Behavior

Options
Hi,
4WLjVD2
I have a coroutine LoadLevelAsync with the below code:
IEnumerator LoadLevelAsync()
    {
        PhotonNetwork.LoadLevel(1);

        while(PhotonNetwork.LevelLoadingProgress < 1f)
        {
            double progress = Mathf.Clamp01(PhotonNetwork.LevelLoadingProgress);
            Debug.Log(progress);
            yield return null;
        }        
    }

It is invoked via the following method:
public void LoadLevel()
    {
        StartCoroutine(LoadLevelAsync());
    }

What I expect/need in the console logs is something gradual, like 0.1, 0.2, 0.3...leading up to 1.0. Think progress/loading bar. Instead, it seems to shoot right from 0 to just about .9:
https://imgur.com/a/4WLjVD2

Seeing as how PUN2 got rid of LoadLevelAsync, I cannot assign the task to an AsyncOperation variable to track, so I am relying on that LevelLoadingProgress to behave as expected. The existing PhotonNetwork.LoadLevel documentation mentions it is asynchronous, but the method itself is void so cannot be assigned that way as far as I can tell.

Any help would be greatly appreciated!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @nightshot17410,

    Thank you for choosing Photon!

    This looks like an old issue (see this old forum discussion).

    What is the behaviour you see when you try loading the same scene using Unity's SceneManager.LoadSceneAsync? Meaning if you load the same scene offline on the client and track the loading progress what values do you get per frame before the scene is loaded?
    Maybe the scene is small enough to be loaded quickly and for the progress to jump from 0 to 0.9.

    You could also try adding a Threed.Sleep(1000) in an Awake script in the new scene to be loaded or some other code to delay new scene loading.

    Otherwise this will need to wait until next year.
  • @JohnTube Sorry to necro an old post, but just wanted to come back for future readers - This was simply due to performing this test in Unity Editor. The PhotonNetwork.LevelLoadingProgress works very well if you're in an actual build.