diff --git a/packages/assets/src/AssetManager.ts b/packages/assets/src/AssetManager.ts index 481408a..ae27cbf 100644 --- a/packages/assets/src/AssetManager.ts +++ b/packages/assets/src/AssetManager.ts @@ -9,6 +9,7 @@ export class AssetManager implements IAssetManager { private _textures: Map = new Map(); private _collections: Map = new Map(); + private _missingAssetNames: Set = new Set(); public getTexture(name: string): Texture { @@ -30,6 +31,8 @@ export class AssetManager implements IAssetManager { if(!name) return null; + if(this._missingAssetNames.has(name)) return null; + for(const collection of this._collections.values()) { if(!collection) continue; @@ -41,6 +44,8 @@ export class AssetManager implements IAssetManager return existing; } + this._missingAssetNames.add(name); + return null; } @@ -70,6 +75,8 @@ export class AssetManager implements IAssetManager this._collections.set(collection.name, collection); + if(this._missingAssetNames.size > 0) this._missingAssetNames.clear(); + return collection; }