Skip to content

Commit 050aee5

Browse files
committed
fix(soba/staging): dispose texture on destroy
1 parent cdd34ed commit 050aee5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libs/soba/staging/src/lib/environment/environment.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export class NgtsEnvironmentCube {
179179
effect((onCleanup) => {
180180
const texture = _texture();
181181
if (!texture) return;
182+
182183
const { background = false, scene, ...config } = this.envConfig();
183184
const cleanup = setEnvProps(background, scene, this.store.scene(), texture, config);
184185
this.envSet.emit();
@@ -365,6 +366,10 @@ export class NgtsEnvironmentGround {
365366

366367
constructor() {
367368
extend({ GroundProjectedEnv });
369+
370+
inject(DestroyRef).onDestroy(() => {
371+
this.defaultTexture()?.dispose();
372+
});
368373
}
369374
}
370375

0 commit comments

Comments
 (0)