Import progress doesn't count downloaded bytes

オープン
#845 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
csharp, unity
領域
game-dev

調査の方向性

GLTFSceneImporter.LoadSceneAsync と ImportProgress および UnityWebRequestLoader のエントリーポイントから開始し、buffer、node、texture のインポートが始まる前に Web ダウンロードがどのように進捗を報告するかを追跡します。完了条件は、Web モデルのダウンロード中に ImportProgress がダウンロード済みバイト数を反映し、処理全体を通してローディングバーが進むことです。この issue ではファイルやテストは指定されていません。

索引モデルが issue の本文から書いたものです。

説明

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 🩹
主要言語
C#
スター
2.3k
フォーク
539
平均マージ
3日 15時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

KhronosGroup/UnityGLTF のほかの issue

KhronosGroup/UnityGLTF の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。