diff --git a/examples/common/Character.ts b/examples/common/Character.ts index 0895378..dc28567 100644 --- a/examples/common/Character.ts +++ b/examples/common/Character.ts @@ -72,12 +72,14 @@ export class Character { const nextFrame = () => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.node.texture = this.rightFrames[curI]!; - this.node.textureOptions.flipX = flipX; curI++; if (curI > iEnd) { curI = iStart; } }; + // textureOptions must be replaced wholesale, never mutated in place — + // nodes created without options share a frozen default object. + this.node.textureOptions = { flipX }; nextFrame(); this.curIntervalAnimation = setInterval(nextFrame, intervalMs); } diff --git a/examples/tests/texture-cleanup-critical.ts b/examples/tests/texture-cleanup-critical.ts index 187d70d..73531e3 100644 --- a/examples/tests/texture-cleanup-critical.ts +++ b/examples/tests/texture-cleanup-critical.ts @@ -51,6 +51,10 @@ See docs/ManualRegressionTests.md for more information. fontSize: 40, }); + // textureOptions must be replaced wholesale, never mutated in place — + // nodes created without options share a frozen default object. + screen.textureOptions = { preload: true }; + // Create a new random texture every 10ms setInterval(() => { screen.texture = renderer.createTexture('NoiseTexture', { @@ -58,6 +62,5 @@ See docs/ManualRegressionTests.md for more information. h: 500, cacheId: Math.floor(Math.random() * 100000), }); - screen.textureOptions.preload = true; }, 100); }