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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(editor): an empty scene is a loaded scene
yhh1a1984f984e8
diff --git a/desktop/src/main.tsx b/desktop/src/main.tsxindex c9caf4498..5e4adecf5 100644--- a/desktop/src/main.tsx+++ b/desktop/src/main.tsx@@ -173,11 +173,17 @@ function buildEditorAutomation(): unknown {);}useEditorStore.getState().enterEditor();+ // Wait for a scene to be LOADED, which is not the same question as "does+ // it have entities". An empty scene is where every new project starts, and+ // asking for entities made that project stall the full 30s and then fail+ // its very first tool call — the one place a driver has nothing to go on.const t0 = Date.now();- while (EditorControlSurface.getSceneTree().length === 0 && Date.now() - t0 < 30_000) {+ const loaded = (): boolean =>+ ProjectStore.getSnapshot()?.currentScene != null || EditorControlSurface.getSceneTree().length > 0;+ while (!loaded() && Date.now() - t0 < 30_000) {await new Promise((r) => setTimeout(r, 100));}- if (EditorControlSurface.getSceneTree().length === 0) {+ if (!loaded()) {throw new Error(`the project at ${root} opened but no scene loaded — it may have none yet. `+ 'Name one with open_scene, or create one with create_scene_file.',