Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(text): stopping lets go of the labels the engine holds, so the next Play cannot draw them on other entities

yhh71d19ce8eb10
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ef97741f..6836bb65f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ published separately; it ships inside the editor.
### Fixed
+- **Labels no longer come back as black boxes after a change between Plays.** Stopping left each label's geometry in the engine, by entity number. Adding, removing or dragging anything before pressing Play again moved those numbers, so the old labels drew on other entities from an atlas already released.
- **Particles and plain sprites in a Canvas paint by their place in its tree.** An emitter listed after a panel went under it, and one listed before a plain `Sprite` went over it. Both now follow the hierarchy like the controls round them, and the `layer` they were authored with is no longer overwritten. A `Sprite` with no `UINode` under a Canvas may change place as a result; a non-zero `layer` keeps the old order.
- **A trigger no longer stops a 2D character.** The mover took a sensor for a wall and for a floor.
diff --git a/desktop b/desktop
index 6192d1d00..5b91b3457 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 6192d1d007ef555eb5a6ddc807b5df172d9b233e
+Subproject commit 5b91b3457d6248dfa2db46f692640aa637e16ed0
diff --git a/sdk/src/ui/text/plugin.ts b/sdk/src/ui/text/plugin.ts
index 9f7e6f789..0150f2e0d 100644
--- a/sdk/src/ui/text/plugin.ts
+++ b/sdk/src/ui/text/plugin.ts
@@ -226,6 +226,12 @@ export class TextPlugin implements Plugin {
this.states_.delete(app);
for (const run of state.preloads) run.job.finish();
const errors: unknown[] = [];
+ // The engine keeps these by entity number and may outlive this app: a replay in the same realm numbers its entities afresh,
+ // and a label left behind would draw on whichever one has its number now, from an atlas released below.
+ const api = engineApi(app);
+ for (const entity of state.retained.keys()) {
+ try { api?.renderer_retainedTextClear?.(entity); } catch (error) { errors.push(error); }
+ }
for (const renderer of [state.world.bitmap, state.world.sdf, state.screen.bitmap, state.screen.sdf]) {
try { renderer?.dispose(); } catch (error) { errors.push(error); }
}
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index b66b350b6..7147a6b36 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -4230,6 +4230,8 @@ export const NOTED = {
{"note": "GPU particles can hit things, tell each other, and drag trails."},
"fix(ui): particles and plain sprites in a Canvas paint by their place in its tree":
{"note": "Particles and plain sprites in a Canvas paint by their place in its tree."},
+ "fix(text): stopping lets go of the labels the engine holds, so the next Play cannot draw them on other entities":
+ {"note": "Labels no longer come back as black boxes after a change between Plays."},
"fix(assets): one hot load at a time per asset, so two rescans cannot lose a texture":
{"note": "A texture stays on a scene that rescans as it is placed."},
"feat(rig): the 2D rig editor, from an image to a character in the scene":