UnityGLTF
UnityGLTF copied to clipboard
`onLoadComplete` is called before entire loading progress is finished
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
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)