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(examples): Dusk Fort's scene carries its .meta, so its package reaches the fort instead of booting to asset not found

yhh8e9bef634ac4
diff --git a/examples/dusk-fort/assets/scenes/main.esscene.meta b/examples/dusk-fort/assets/scenes/main.esscene.meta
new file mode 100644
index 000000000..4f93b8724
--- /dev/null
+++ b/examples/dusk-fort/assets/scenes/main.esscene.meta
@@ -0,0 +1,6 @@
+{
+ "uuid": "92a6c84a-5c23-46fc-8a2a-919c0de83391",
+ "version": "2.0",
+ "type": "scene",
+ "importer": {}
+}
diff --git a/examples/dusk-fort/tools/build-scene.mjs b/examples/dusk-fort/tools/build-scene.mjs
index af242f0fe..78b12fcfb 100644
--- a/examples/dusk-fort/tools/build-scene.mjs
+++ b/examples/dusk-fort/tools/build-scene.mjs
@@ -11,7 +11,8 @@
*
* node examples/dusk-fort/tools/build-scene.mjs
*/
-import { readFileSync, writeFileSync } from 'node:fs';
+import { randomUUID } from 'node:crypto';
+import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -154,4 +155,10 @@ for (const e of door.entities.filter((x) => x.prefabEntityId !== 'root')) {
}
writeFileSync(path.join(ROOT, 'assets/scenes/main.esscene'), JSON.stringify({ version: 4, name: 'Main', entities }, null, 2));
+// The scene is an asset like any other: without its .meta it has no id, an export reaches nothing from it, and the
+// package boots to "asset not found". Kept when it exists, so a rebuild does not change what refers to it.
+const meta = path.join(ROOT, 'assets/scenes/main.esscene.meta');
+if (!existsSync(meta)) {
+ writeFileSync(meta, `${JSON.stringify({ uuid: randomUUID(), version: '2.0', type: 'scene', importer: {} }, null, 2)}\n`);
+}
console.log(`wrote ${entities.length} entities`);