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: sync Text component changes immediately in editor

esengine6d76d6ca7888
diff --git a/editor/src/scene/EditorSceneManager.ts b/editor/src/scene/EditorSceneManager.ts
index e7a72313d..c576c10ad 100644
--- a/editor/src/scene/EditorSceneManager.ts
+++ b/editor/src/scene/EditorSceneManager.ts
@@ -242,6 +242,16 @@ export class EditorSceneManager {
this.syncTransform(entity, null, entityId);
}
+ syncTextForEntity(entityId: number): void {
+ const entity = this.entityMap_.get(entityId);
+ if (entity === undefined) return;
+ const entityData = this.entityDataMap_.get(entityId);
+ if (!entityData) return;
+ const textComp = entityData.components.find(c => c.type === 'Text');
+ if (!textComp) return;
+ this.syncText(entity, textComp.data, entityId);
+ }
+
reparentEntity(entityId: number, newParentId: number | null): void {
const entity = this.entityMap_.get(entityId);
if (entity === undefined) return;
diff --git a/editor/src/sync/RuntimeSyncService.ts b/editor/src/sync/RuntimeSyncService.ts
index 3fc1816bf..d6970655d 100644
--- a/editor/src/sync/RuntimeSyncService.ts
+++ b/editor/src/sync/RuntimeSyncService.ts
@@ -104,6 +104,10 @@ export class RuntimeSyncService {
this.sceneManager_.syncScreenSpaceDescendants(event.entity);
}
+ if (event.componentType === 'Text') {
+ this.sceneManager_.syncTextForEntity(event.entity);
+ }
+
this.scheduleEntityUpdate(event.entity);
if (event.componentType === 'Canvas') {