Import progress doesn't count downloaded bytes

Aperta
#845 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp, unity
Ambito
game-dev

Direzione di ricerca

Inizia da GLTFSceneImporter.LoadSceneAsync e dai punti di ingresso ImportProgress e UnityWebRequestLoader, quindi traccia il modo in cui i download web riportano l’avanzamento prima che inizi l’importazione di buffer, nodi e texture. Il lavoro è completato quando ImportProgress riflette i byte scaricati durante il download del modello web, così che una barra di caricamento avanzi per tutta la durata dell’operazione; l’issue non indica file né test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?
  • Editor Import
  • Runtime Import
  • Editor Export
  • Runtime Export
Additional Info 📜

No response

Validations 🩹
Lingua principale
C#
Stelle
2.3k
Fork
539
Merge medio
3g 15h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di KhronosGroup/UnityGLTF

Tutte le issue di KhronosGroup/UnityGLTF

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.