Page 1 of 1

Monitor Scene Change Progress?

Posted: Wed Jun 24, 2020 5:47 pm
by VoodooDetective
I was wondering what the best way to monitor scene change progress would be. Here's what I was trying, but it doesn't seem to work very well.

Code: Select all

    public class SceneChangeCanvasController : MonoBehaviour
    {
        private Coroutine progressMonitoringCoroutine;

        public void OnLeaveBegin()
        {
            progressMonitoringCoroutine = StartCoroutine(MonitorSceneChangeProgress());
        }



        public void OnEnterBegin()
        {
            StopCoroutine(progressMonitoringCoroutine);
        }


        private IEnumerator MonitorSceneChangeProgress()
        {
            while (true)
            {
                if (SaveSystem.currentAsyncOperation != null)
                {
                    Debug.Log("monitoring progress: " + SaveSystem.currentAsyncOperation.progress);
                }
                yield return new WaitForSeconds(0.5f);
            }
        }
    }
Even for long transitions, it seems like it only over reports 90% and then 100%.

Re: Monitor Scene Change Progress?

Posted: Wed Jun 24, 2020 7:46 pm
by Tony Li
Are you monitoring in the Unity editor or in a build? Unity does not return accurate progress in the editor.

Re: Monitor Scene Change Progress?

Posted: Wed Jun 24, 2020 9:36 pm
by VoodooDetective
Ahhh ok, so that's probably why. Thanks for explaining that! I was working in the editor.