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.

chore(editor): worldComp automation probe resolves any component by name

esengineecb114fdf4c9
diff --git a/desktop/src/main.tsx b/desktop/src/main.tsx
index 3173b5f9b..9ade71201 100644
--- a/desktop/src/main.tsx
+++ b/desktop/src/main.tsx
@@ -43,7 +43,7 @@ import { dockApi } from './layout/dockApi';
import { EditorControlSurface } from './engine/EditorSession';
import { SceneModel } from './engine/SceneModel';
import { EngineHost } from './engine/EngineHost';
-import { UINode, UIVisual, Particle } from 'esengine';
+import { Particle, getComponent } from 'esengine';
import { applyFxPreview, initFxPreviewEditRestart } from './engine/fxPreview';
import { commands } from './commands/registry';
import { ViewportController } from './engine/ViewportController';
@@ -119,11 +119,11 @@ if (new URLSearchParams(location.search).has('automation')) {
/** The LIVE World component data for a SOURCE entity — for verifying that a
* model edit actually reached the engine (vs stayed model-only). */
runtimeFor: (id: number) => SceneModel.runtimeFor(id),
- worldComp: (id: number, comp: 'UINode' | 'UIVisual') => {
+ worldComp: (id: number, comp: string) => {
const rt = SceneModel.runtimeFor(id);
const w = EngineHost.world;
- const def = comp === 'UINode' ? UINode : UIVisual;
- return rt != null && w?.has(rt, def) ? w.get(rt, def) : null;
+ const def = getComponent(comp);
+ return rt != null && def && w?.has(rt, def) ? w.get(rt, def) : null;
},
pickAt: (cx: number, cy: number) =>
ViewportController.pickEntitiesAt(cx, cy).map((rt) => ({ rt, src: SceneModel.sourceFor(rt) })),