Import progress doesn't count downloaded bytes
Describe the bug 💬
The implementation ImportProgress.Progress doesn't take into consideration the download bytes when importing models from the web.
This means that when importing a web model, the Progress value stays at 0 during all the download phase (which is generally the longest one), then it rapidly goes to 1 when importing buffers, nodes and textures.
In this way it is impossible to create a loading bar. The only alternative I found is to download the file separately and then import it as usual.
Steps to reproduce 🔢
Import a .glb from web url with LoadSceneAsync() like this
private CancellationTokenSource tokenSource;
string directory = Path.GetDirectoryName(someWebUrl);
string fileName = Path.GetFileName(someWebUrl);
...
ImportOptions importOpt = new ImportOptions
{
DataLoader = new UnityWebRequestLoader(directory),
CameraImport = CameraImportOption.None
};
GLTFSceneImporter importer = new GLTFSceneImporter(fileName, importOpt);
Progress<ImportProgress> progressReporter = new Progress<ImportProgress>();
progressReporter.ProgressChanged += OnImportProgress;
importCancellationTokenSource = new CancellationTokenSource();
await importer.LoadSceneAsync(-1, true, OnImportComplete, tokenSource.Token, progressReporter);
...
private void OnImportProgress(object sender, ImportProgress prog)
{
Debug.Log(Time.realTimeSinceStartup + " - " prog.ToString());
}
Notice how the logs show almost no progress while downloading, and then abruptly increase when the GLB import phase begins.
Files to reproduce the issue ♻
No response
Editor Version 🎲
6000.0.37
Render Pipeline and version
Any
Operating System 👩💻
Windows
When does this problem happen?
- [x] Editor Import
- [x] Runtime Import
- [ ] Editor Export
- [ ] Runtime Export
Additional Info 📜
No response
Validations 🩹
- [x] I have searched existing issues: no issue already exist that reports the same problem.
- [x] I follow the Code of Conduct
- [x] provided a minimal reproducible example, including files when necessary.
Please follow the bug report template, which contains info on which versions of Unity, UnityGLTF, etc you use, which platforms, and so on. Otherwise we'll have to close the report as non-actionable. Thanks!
Hi,
this is not a bug, actually. It's more a feature request. Should I still use a bug template?
If the progress value stays at 0 that's a bug – it should not stay at 0 if we can show meaningful progress. Please use the bug template :)
Issue updated with bug template as requested!