From 9ac2852a418b2102d4c4363aa98cfa7cd5100681 Mon Sep 17 00:00:00 2001 From: Will Greenberg Date: Mon, 20 Jan 2025 11:35:42 -0800 Subject: [PATCH] unity: fix error when reloading a scene --- src/Common/Unity/AssetManager.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Common/Unity/AssetManager.ts b/src/Common/Unity/AssetManager.ts index 28bfb02e2..ba294c000 100644 --- a/src/Common/Unity/AssetManager.ts +++ b/src/Common/Unity/AssetManager.ts @@ -156,8 +156,10 @@ export class AssetFile { this.waitForHeaderPromise = null; } - public waitForHeader(): Promise { - return assertExists(this.waitForHeaderPromise); + public async waitForHeader() { + if (this.waitForHeaderPromise !== null) { + await this.waitForHeaderPromise; + } } private async initFullInternal(dataFetcher: DataFetcher): Promise {