UnityGLTF icon indicating copy to clipboard operation
UnityGLTF copied to clipboard

`onLoadComplete` is called before entire loading progress is finished

Open MarcusGT076 opened this issue 11 months ago • 1 comments

Dear Khronos team,

i wanted to use the progress as a progression bar. The problem is that he calls onLoadComplete before the progress is finished. When he reaches 1% he starts to reference the loaded scene in the scene already. Did i use it in a wrong way ? Would be nice if you can help. Here is my code snippet.

    private async Task LoadGltf()
    {
        progress = new Progress<ImportProgress>();
        progress.ProgressChanged += (sender, ev) => ShowProgress(ev);
        await sceneImporter.LoadSceneAsync(sceneIndex: 0, true, onLoadComplete: OnLoadComplete, progress:progress);
        await Task.Yield();
    }
    private void ShowProgress(ImportProgress ev)
    {
        Debug.Log("Progress is : " + ev.Progress * 100);
    }

Cheers, Marcus

MarcusGT076 avatar Jan 16 '25 01:01 MarcusGT076

Hey, thanks for the issue! i added a Task.Yield in the LoadSceneAsync, this ensures now the correct order :) Will be available in the next release (8fc79ecb7bdd4cbe7d1d172843b594ec22188533)

robertdorn83 avatar Feb 05 '25 11:02 robertdorn83