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.

feat(sdk): a scene is checked the way a prefab has always been

esenginecbe8d9f570a6
diff --git a/build-tools/cli.js b/build-tools/cli.js
index f31f2b418..830ffe8ee 100644
--- a/build-tools/cli.js
+++ b/build-tools/cli.js
@@ -18,7 +18,7 @@ import { startWatch } from './tasks/watch.js';
import { BuildManifest } from './manifest.js';
import { handleBuildError } from './utils/errorHelp.js';
import { checkExamples } from './tasks/check-examples.js';
-import { validatePrefabs } from './tasks/validate-prefabs.js';
+import { validateDocuments } from './tasks/validate-documents.js';
program
.name('esengine-build')
@@ -288,12 +288,12 @@ program
});
program
- .command('validate-prefabs')
- .description('Run the unified prefab validator over every shipped .esprefab')
+ .command('validate-documents')
+ .description('Run the shared document validators over every shipped scene and prefab')
.action(async () => {
- logger.header('Validate Prefabs');
+ logger.header('Validate Documents');
const startTime = Date.now();
- await validatePrefabs(config.paths.root);
+ await validateDocuments(config.paths.root);
logger.printTime(startTime);
});
diff --git a/build-tools/tasks/validate-prefabs.js b/build-tools/tasks/validate-documents.js
similarity index 52%
rename from build-tools/tasks/validate-prefabs.js
rename to build-tools/tasks/validate-documents.js
index e27019897..185d5de92 100644
--- a/build-tools/tasks/validate-prefabs.js
+++ b/build-tools/tasks/validate-documents.js
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
- * @file validate-prefabs.js
- * @brief Run the SDK's unified prefab validator over every shipped .esprefab
+ * @file validate-documents.js
+ * @brief Run the SDK's document validators over every shipped scene and prefab
*
- * Loads each prefab (migrating legacy v1 → current format first), resolves
- * nested/variant refs across the repo by uuid, and runs `validatePrefab`. Any
- * ERROR fails CI; warnings (stale overrides, dangling refs) are printed only.
- * The validator itself lives in the SDK so editor / runtime / cook / CI all
- * share ONE implementation.
+ * Loads each document (migrating to the current format first), resolves a
+ * prefab's nested/variant refs across the repo by uuid, and validates. Any ERROR
+ * fails CI; warnings (stale overrides, dangling refs) are printed only. The
+ * validators live in the SDK so editor / runtime / cook / CI all share ONE
+ * implementation, and both document kinds are judged by the same checks.
*/
import { readFileSync, readdirSync, statSync, existsSync } from 'fs';
@@ -16,11 +16,12 @@ import path from 'path';
import { pathToFileURL } from 'url';
import * as logger from '../utils/logger.js';
-// Every directory tree that ships .esprefab assets to users.
-const PREFAB_ROOTS = ['examples', 'sdk/src/ui/widgets/prefabs', 'desktop/templates'];
+// Every directory tree that ships authored documents to users.
+const DOCUMENT_ROOTS = ['examples', 'sdk/src/ui/widgets/prefabs', 'desktop/templates'];
const SKIP_DIRS = new Set(['node_modules', '.esengine', 'dist', '.git']);
+const EXTENSIONS = ['.esprefab', '.esscene'];
-function walkPrefabs(dir, out) {
+function walkDocuments(dir, out) {
if (!existsSync(dir)) return;
for (const entry of readdirSync(dir)) {
const full = path.join(dir, entry);
@@ -28,43 +29,54 @@ function walkPrefabs(dir, out) {
try { st = statSync(full); } catch { continue; }
if (st.isDirectory()) {
if (SKIP_DIRS.has(entry)) continue;
- walkPrefabs(full, out);
- } else if (entry.endsWith('.esprefab')) {
+ walkDocuments(full, out);
+ } else if (EXTENSIONS.some((ext) => entry.endsWith(ext))) {
out.push(full);
}
}
}
-export async function validatePrefabs(rootDir) {
- logger.step('Validating prefab assets...');
+/** One finding, in the shape the report prints. */
+const line = (rel, d) => {
+ const at = d.entityId !== undefined ? ` @${d.entityId}${d.field ? `.${d.field}` : ''}` : '';
+ return ` ${rel} [${d.code}]${at} ${d.message}`;
+};
+
+export async function validateDocuments(rootDir) {
+ logger.step('Validating scenes and prefabs...');
const sdkNode = path.join(rootDir, 'sdk', 'dist', 'index.node.js');
if (!existsSync(sdkNode)) {
logger.error('SDK dist not found. Build SDK first: pnpm --filter ./sdk build');
process.exit(1);
}
- const { validatePrefab, migratePrefabData, PREFAB_FORMAT_VERSION } = await import(pathToFileURL(sdkNode).href);
+ const {
+ validatePrefab, migratePrefabData, PREFAB_FORMAT_VERSION,
+ validateScene, migrateSceneData, SCENE_FORMAT_VERSION,
+ } = await import(pathToFileURL(sdkNode).href);
const files = [];
- for (const rel of PREFAB_ROOTS) walkPrefabs(path.join(rootDir, rel), files);
+ for (const rel of DOCUMENT_ROOTS) walkDocuments(path.join(rootDir, rel), files);
if (files.length === 0) {
- logger.warn('No .esprefab files found');
+ logger.warn('No documents found');
return { files: 0, errors: 0, warnings: 0 };
}
- // Parse + migrate every prefab up-front, and index by asset uuid (from the
- // sibling .meta) so nested/variant `@uuid:` refs resolve for the loader.
- const parsed = new Map(); // absolute file → migrated PrefabData
+ // Parse + migrate everything up-front, and index prefabs by asset uuid (from
+ // the sibling .meta) so nested/variant `@uuid:` refs resolve for the loader.
+ const parsed = new Map(); // absolute file → migrated document
const rawVersions = new Map(); // absolute file → raw (pre-migration) version
const byUuid = new Map(); // asset uuid → migrated PrefabData
let errors = 0;
for (const file of files) {
const rel = path.relative(rootDir, file);
+ const isPrefab = file.endsWith('.esprefab');
try {
const raw = JSON.parse(readFileSync(file, 'utf8'));
rawVersions.set(file, raw && raw.version != null ? String(raw.version) : '(none)');
- const data = migratePrefabData(raw).data;
+ const data = isPrefab ? migratePrefabData(raw).data : migrateSceneData(raw).data;
parsed.set(file, data);
+ if (!isPrefab) continue;
const metaPath = `${file}.meta`;
if (existsSync(metaPath)) {
const meta = JSON.parse(readFileSync(metaPath, 'utf8'));
@@ -88,33 +100,36 @@ export async function validatePrefabs(rootDir) {
const data = parsed.get(file);
if (!data) continue; // already counted as a parse error
const rel = path.relative(rootDir, file);
+ const isPrefab = file.endsWith('.esprefab');
- // Repo assets must already be current format — legacy v1 loads via
+ // Repo assets must already be current format — a legacy file loads via
// auto-migration for USERS, but our own examples/templates/widgets model
- // best practice. Re-save with the editor's "Resave All Prefabs".
+ // best practice. Re-save them to fix.
const fileErrors = [];
const fileWarnings = [];
const rawVersion = rawVersions.get(file);
- if (rawVersion !== PREFAB_FORMAT_VERSION) {
- fileErrors.push(` ${rel} [outdated-format] version "${rawVersion}" is not the current "${PREFAB_FORMAT_VERSION}" — re-save it`);
+ const wantVersion = isPrefab ? PREFAB_FORMAT_VERSION : String(SCENE_FORMAT_VERSION);
+ if (rawVersion !== wantVersion) {
+ fileErrors.push(` ${rel} [outdated-format] version "${rawVersion}" is not the current "${wantVersion}" — re-save it`);
}
- for (const d of validatePrefab(data, { loadPrefab: (ref) => resolveRef(ref, file) })) {
- const at = d.entityId ? ` @${d.entityId}${d.field ? `.${d.field}` : ''}` : '';
- const line = ` ${rel} [${d.code}]${at} ${d.message}`;
- (d.severity === 'error' ? fileErrors : fileWarnings).push(line);
+ const diags = isPrefab
+ ? validatePrefab(data, { loadPrefab: (ref) => resolveRef(ref, file) })
+ : validateScene(data);
+ for (const d of diags) {
+ (d.severity === 'error' ? fileErrors : fileWarnings).push(line(rel, d));
}
if (fileErrors.length === 0 && fileWarnings.length === 0) {
logger.success(rel);
continue;
}
- for (const line of fileErrors) logger.error(line);
- for (const line of fileWarnings) logger.warn(line);
+ for (const l of fileErrors) logger.error(l);
+ for (const l of fileWarnings) logger.warn(l);
errors += fileErrors.length;
warnings += fileWarnings.length;
}
- logger.step(`Prefab validation: ${files.length} files, ${errors} error(s), ${warnings} warning(s)`);
+ logger.step(`Document validation: ${files.length} files, ${errors} error(s), ${warnings} warning(s)`);
if (errors > 0) process.exitCode = 1;
return { files: files.length, errors, warnings };
}
diff --git a/desktop/public/scenes/bitmaptext.esscene b/desktop/public/scenes/bitmaptext.esscene
index 0b3e6718b..84a019bcb 100644
--- a/desktop/public/scenes/bitmaptext.esscene
+++ b/desktop/public/scenes/bitmaptext.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "BitmapTextGate",
"entities": [
{
diff --git a/desktop/public/scenes/bloom-ldr.esscene b/desktop/public/scenes/bloom-ldr.esscene
index 39587402e..202d04c45 100644
--- a/desktop/public/scenes/bloom-ldr.esscene
+++ b/desktop/public/scenes/bloom-ldr.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "HDR Bloom",
"entities": [
{
diff --git a/desktop/public/scenes/camera-culling.esscene b/desktop/public/scenes/camera-culling.esscene
index 365d315a8..90f0b931e 100644
--- a/desktop/public/scenes/camera-culling.esscene
+++ b/desktop/public/scenes/camera-culling.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Camera.cullingMask drops whole layers: the HUD (its Canvas is on layer 1) and the blue sprite (layer 2) are cleared from the mask, leaving only the green world on layer 0.",
"entities": [
{
diff --git a/desktop/public/scenes/depth-layers.esscene b/desktop/public/scenes/depth-layers.esscene
index 734f90699..a6549c3d8 100644
--- a/desktop/public/scenes/depth-layers.esscene
+++ b/desktop/public/scenes/depth-layers.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "DepthLayers",
"entities": [
{
diff --git a/desktop/public/scenes/hdr-bloom.esscene b/desktop/public/scenes/hdr-bloom.esscene
index 2470b322a..432d96350 100644
--- a/desktop/public/scenes/hdr-bloom.esscene
+++ b/desktop/public/scenes/hdr-bloom.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "HDR Bloom",
"entities": [
{
diff --git a/desktop/public/scenes/ktx2-orientation.esscene b/desktop/public/scenes/ktx2-orientation.esscene
index bbf6d9887..efb6ea2c0 100644
--- a/desktop/public/scenes/ktx2-orientation.esscene
+++ b/desktop/public/scenes/ktx2-orientation.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "KTX2 Orientation",
"entities": [
{
diff --git a/desktop/public/scenes/ktx2-sprite.esscene b/desktop/public/scenes/ktx2-sprite.esscene
index cbca423c2..d64a57280 100644
--- a/desktop/public/scenes/ktx2-sprite.esscene
+++ b/desktop/public/scenes/ktx2-sprite.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "KTX2 Sprite",
"entities": [
{
diff --git a/desktop/public/scenes/lut-grade.esscene b/desktop/public/scenes/lut-grade.esscene
index 74a98eb25..609e9c079 100644
--- a/desktop/public/scenes/lut-grade.esscene
+++ b/desktop/public/scenes/lut-grade.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "LutGrade",
"entities": [
{
diff --git a/desktop/public/scenes/mat-builtin-lit.esscene b/desktop/public/scenes/mat-builtin-lit.esscene
index e7dc9bad2..4f955894c 100644
--- a/desktop/public/scenes/mat-builtin-lit.esscene
+++ b/desktop/public/scenes/mat-builtin-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-dissolve.esscene b/desktop/public/scenes/mat-dissolve.esscene
index 1a5564b75..da6019287 100644
--- a/desktop/public/scenes/mat-dissolve.esscene
+++ b/desktop/public/scenes/mat-dissolve.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-graph.esscene b/desktop/public/scenes/mat-graph.esscene
index 894e66fce..1acf5510b 100644
--- a/desktop/public/scenes/mat-graph.esscene
+++ b/desktop/public/scenes/mat-graph.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-instance.esscene b/desktop/public/scenes/mat-instance.esscene
index 9325c0486..77faa5e91 100644
--- a/desktop/public/scenes/mat-instance.esscene
+++ b/desktop/public/scenes/mat-instance.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-flatnormal.esscene b/desktop/public/scenes/mat-lit-flatnormal.esscene
index 275d519db..e4f9e3def 100644
--- a/desktop/public/scenes/mat-lit-flatnormal.esscene
+++ b/desktop/public/scenes/mat-lit-flatnormal.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-normal.esscene b/desktop/public/scenes/mat-lit-normal.esscene
index fa2e6cc43..880bf87cd 100644
--- a/desktop/public/scenes/mat-lit-normal.esscene
+++ b/desktop/public/scenes/mat-lit-normal.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-point.esscene b/desktop/public/scenes/mat-lit-point.esscene
index 0a7f9fbf2..ec04aa776 100644
--- a/desktop/public/scenes/mat-lit-point.esscene
+++ b/desktop/public/scenes/mat-lit-point.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-shadow-dir.esscene b/desktop/public/scenes/mat-lit-shadow-dir.esscene
index f1e768503..a01bfd176 100644
--- a/desktop/public/scenes/mat-lit-shadow-dir.esscene
+++ b/desktop/public/scenes/mat-lit-shadow-dir.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-shadow-hard.esscene b/desktop/public/scenes/mat-lit-shadow-hard.esscene
index 3e53f5bbf..e3988b900 100644
--- a/desktop/public/scenes/mat-lit-shadow-hard.esscene
+++ b/desktop/public/scenes/mat-lit-shadow-hard.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-shadow-soft.esscene b/desktop/public/scenes/mat-lit-shadow-soft.esscene
index 1c474c399..77cef081c 100644
--- a/desktop/public/scenes/mat-lit-shadow-soft.esscene
+++ b/desktop/public/scenes/mat-lit-shadow-soft.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-shadow.esscene b/desktop/public/scenes/mat-lit-shadow.esscene
index 6922cdb27..835c5208a 100644
--- a/desktop/public/scenes/mat-lit-shadow.esscene
+++ b/desktop/public/scenes/mat-lit-shadow.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit-spot.esscene b/desktop/public/scenes/mat-lit-spot.esscene
index ff8af2415..13d45c3f0 100644
--- a/desktop/public/scenes/mat-lit-spot.esscene
+++ b/desktop/public/scenes/mat-lit-spot.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-lit.esscene b/desktop/public/scenes/mat-lit.esscene
index 5425cb9b5..8ef91a47b 100644
--- a/desktop/public/scenes/mat-lit.esscene
+++ b/desktop/public/scenes/mat-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-sw.esscene b/desktop/public/scenes/mat-sw.esscene
index 5afc700f2..3118dc942 100644
--- a/desktop/public/scenes/mat-sw.esscene
+++ b/desktop/public/scenes/mat-sw.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-tex.esscene b/desktop/public/scenes/mat-tex.esscene
index cc901cd10..15f170987 100644
--- a/desktop/public/scenes/mat-tex.esscene
+++ b/desktop/public/scenes/mat-tex.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mat-tint.esscene b/desktop/public/scenes/mat-tint.esscene
index 6644f693d..3916a6967 100644
--- a/desktop/public/scenes/mat-tint.esscene
+++ b/desktop/public/scenes/mat-tint.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/mesh2d.esscene b/desktop/public/scenes/mesh2d.esscene
index 4ae54125a..23cbd2504 100644
--- a/desktop/public/scenes/mesh2d.esscene
+++ b/desktop/public/scenes/mesh2d.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Mesh2D",
"entities": [
{
diff --git a/desktop/public/scenes/parallax-control.esscene b/desktop/public/scenes/parallax-control.esscene
index 9eade91ca..5035ecddd 100644
--- a/desktop/public/scenes/parallax-control.esscene
+++ b/desktop/public/scenes/parallax-control.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/parallax-shape.esscene b/desktop/public/scenes/parallax-shape.esscene
index ebe1c53bd..68d9b4a0b 100644
--- a/desktop/public/scenes/parallax-shape.esscene
+++ b/desktop/public/scenes/parallax-shape.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "ParallaxShape",
"entities": [
{
diff --git a/desktop/public/scenes/parallax.esscene b/desktop/public/scenes/parallax.esscene
index c212cac7d..2cb35d254 100644
--- a/desktop/public/scenes/parallax.esscene
+++ b/desktop/public/scenes/parallax.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/particle-collision.esscene b/desktop/public/scenes/particle-collision.esscene
index 5016683a0..b03ac0502 100644
--- a/desktop/public/scenes/particle-collision.esscene
+++ b/desktop/public/scenes/particle-collision.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "ParticleCollision",
"entities": [
{
diff --git a/desktop/public/scenes/particle-demo.esscene b/desktop/public/scenes/particle-demo.esscene
index 3e1a9141c..9ad0965b6 100644
--- a/desktop/public/scenes/particle-demo.esscene
+++ b/desktop/public/scenes/particle-demo.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/particle-forcefield.esscene b/desktop/public/scenes/particle-forcefield.esscene
index a69d72dbe..0e27a938c 100644
--- a/desktop/public/scenes/particle-forcefield.esscene
+++ b/desktop/public/scenes/particle-forcefield.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "ParticleForceField",
"entities": [
{
diff --git a/desktop/public/scenes/particle-gradient.esscene b/desktop/public/scenes/particle-gradient.esscene
index 52954391f..0ab9323de 100644
--- a/desktop/public/scenes/particle-gradient.esscene
+++ b/desktop/public/scenes/particle-gradient.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "ParticleGradient",
"entities": [
{
diff --git a/desktop/public/scenes/particle-sizecurve.esscene b/desktop/public/scenes/particle-sizecurve.esscene
index aa763e4ec..c623b52f4 100644
--- a/desktop/public/scenes/particle-sizecurve.esscene
+++ b/desktop/public/scenes/particle-sizecurve.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "ParticleSizeCurve",
"entities": [
{
diff --git a/desktop/public/scenes/particle-trail.esscene b/desktop/public/scenes/particle-trail.esscene
index 07a1b6534..625a5c2a7 100644
--- a/desktop/public/scenes/particle-trail.esscene
+++ b/desktop/public/scenes/particle-trail.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "ParticleTrail",
"entities": [
{
diff --git a/desktop/public/scenes/pixel-perfect.esscene b/desktop/public/scenes/pixel-perfect.esscene
index dd1860989..7a384fd2b 100644
--- a/desktop/public/scenes/pixel-perfect.esscene
+++ b/desktop/public/scenes/pixel-perfect.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/platformer.esscene b/desktop/public/scenes/platformer.esscene
index f38a3c4d2..9fb18a3b3 100644
--- a/desktop/public/scenes/platformer.esscene
+++ b/desktop/public/scenes/platformer.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/postprocess-effects.esscene b/desktop/public/scenes/postprocess-effects.esscene
index cacce4528..b6bd3962d 100644
--- a/desktop/public/scenes/postprocess-effects.esscene
+++ b/desktop/public/scenes/postprocess-effects.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/space-shooter.esscene b/desktop/public/scenes/space-shooter.esscene
index 1eb3eb79a..e21b43f11 100644
--- a/desktop/public/scenes/space-shooter.esscene
+++ b/desktop/public/scenes/space-shooter.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/spine-test.esscene b/desktop/public/scenes/spine-test.esscene
index f5a918052..b41bc9263 100644
--- a/desktop/public/scenes/spine-test.esscene
+++ b/desktop/public/scenes/spine-test.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "SpineTest",
"entities": [
{
diff --git a/desktop/public/scenes/sprite-lit.esscene b/desktop/public/scenes/sprite-lit.esscene
index 6eba99e5f..94a1dc5c4 100644
--- a/desktop/public/scenes/sprite-lit.esscene
+++ b/desktop/public/scenes/sprite-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/sprite-rendering.esscene b/desktop/public/scenes/sprite-rendering.esscene
index 413e3234c..3aa4af823 100644
--- a/desktop/public/scenes/sprite-rendering.esscene
+++ b/desktop/public/scenes/sprite-rendering.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/srgb-midtone.esscene b/desktop/public/scenes/srgb-midtone.esscene
index 4d5a0ac36..4921e4b33 100644
--- a/desktop/public/scenes/srgb-midtone.esscene
+++ b/desktop/public/scenes/srgb-midtone.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "sRGB Midtone Roundtrip",
"entities": [
{
diff --git a/desktop/public/scenes/tilemap-flip.esscene b/desktop/public/scenes/tilemap-flip.esscene
index 0ae83b7e7..adede038e 100644
--- a/desktop/public/scenes/tilemap-flip.esscene
+++ b/desktop/public/scenes/tilemap-flip.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TilemapFlip",
"entities": [
{
diff --git a/desktop/public/scenes/tilemap-gidobj.esscene b/desktop/public/scenes/tilemap-gidobj.esscene
index 054b76260..12769c868 100644
--- a/desktop/public/scenes/tilemap-gidobj.esscene
+++ b/desktop/public/scenes/tilemap-gidobj.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TilemapGidObject",
"entities": [
{
diff --git a/desktop/public/scenes/tilemap-hex.esscene b/desktop/public/scenes/tilemap-hex.esscene
index 21fd9e227..e015d21d6 100644
--- a/desktop/public/scenes/tilemap-hex.esscene
+++ b/desktop/public/scenes/tilemap-hex.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TilemapHex",
"entities": [
{
diff --git a/desktop/public/scenes/tilemap-multiset.esscene b/desktop/public/scenes/tilemap-multiset.esscene
index 3588090f5..83de6dd17 100644
--- a/desktop/public/scenes/tilemap-multiset.esscene
+++ b/desktop/public/scenes/tilemap-multiset.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TilemapMultiset",
"entities": [
{
diff --git a/desktop/public/scenes/tilemap-parallax.esscene b/desktop/public/scenes/tilemap-parallax.esscene
index ae00cba9e..5b4a68c05 100644
--- a/desktop/public/scenes/tilemap-parallax.esscene
+++ b/desktop/public/scenes/tilemap-parallax.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TilemapParallax",
"entities": [
{
diff --git a/desktop/public/scenes/tilemap-spacing.esscene b/desktop/public/scenes/tilemap-spacing.esscene
index 7022252e1..73d960cb9 100644
--- a/desktop/public/scenes/tilemap-spacing.esscene
+++ b/desktop/public/scenes/tilemap-spacing.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TilemapSpacing",
"entities": [
{
diff --git a/desktop/public/scenes/tilemap-transform.esscene b/desktop/public/scenes/tilemap-transform.esscene
index 58e037f7d..61bfff829 100644
--- a/desktop/public/scenes/tilemap-transform.esscene
+++ b/desktop/public/scenes/tilemap-transform.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TilemapTransform",
"entities": [
{
diff --git a/desktop/public/scenes/trail.esscene b/desktop/public/scenes/trail.esscene
index fa09e5b62..479a4049b 100644
--- a/desktop/public/scenes/trail.esscene
+++ b/desktop/public/scenes/trail.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Trail",
"entities": [
{
diff --git a/desktop/public/scenes/ui-layout.esscene b/desktop/public/scenes/ui-layout.esscene
index 963667fe7..e70c337ee 100644
--- a/desktop/public/scenes/ui-layout.esscene
+++ b/desktop/public/scenes/ui-layout.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/public/scenes/ui-list-mask.esscene b/desktop/public/scenes/ui-list-mask.esscene
index d18d75faf..e0d8afb2c 100644
--- a/desktop/public/scenes/ui-list-mask.esscene
+++ b/desktop/public/scenes/ui-list-mask.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "UIMask (Scissor) clips overflowing content to the viewport — the primitive createListView relies on",
"entities": [
{
diff --git a/desktop/public/scenes/ui-node-absolute.esscene b/desktop/public/scenes/ui-node-absolute.esscene
index 018f3df2d..d34964957 100644
--- a/desktop/public/scenes/ui-node-absolute.esscene
+++ b/desktop/public/scenes/ui-node-absolute.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "UINode absolute positioning / inset (REARCH_GUI F3 unification)",
"entities": [
{
diff --git a/desktop/public/scenes/ui-node-flex.esscene b/desktop/public/scenes/ui-node-flex.esscene
index 714206513..bcc61ead2 100644
--- a/desktop/public/scenes/ui-node-flex.esscene
+++ b/desktop/public/scenes/ui-node-flex.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "UINode single-pass flex layout (REARCH_GUI F3.2)",
"entities": [
{
diff --git a/desktop/public/scenes/ui-screen-root.esscene b/desktop/public/scenes/ui-screen-root.esscene
index 16ac7e1a6..b8db0947d 100644
--- a/desktop/public/scenes/ui-screen-root.esscene
+++ b/desktop/public/scenes/ui-screen-root.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Screen root tracks the camera; parented UI rides its parent. The camera starts at the origin and is driven away at runtime, so the layout box moves without resizing.",
"entities": [
{
diff --git a/desktop/public/scenes/ui-text-effects.esscene b/desktop/public/scenes/ui-text-effects.esscene
index 5639ad104..bd6f967f8 100644
--- a/desktop/public/scenes/ui-text-effects.esscene
+++ b/desktop/public/scenes/ui-text-effects.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "SDF text outline + shadow (REARCH_GUI F8)",
"entities": [
{
diff --git a/desktop/public/scenes/ui-text-overflow.esscene b/desktop/public/scenes/ui-text-overflow.esscene
index cdec30574..b05596f3a 100644
--- a/desktop/public/scenes/ui-text-overflow.esscene
+++ b/desktop/public/scenes/ui-text-overflow.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TextOverflow — Visible beside Clip",
"entities": [
{
diff --git a/desktop/public/scenes/ui-text-rect.esscene b/desktop/public/scenes/ui-text-rect.esscene
index b19bae8e4..392bdfc0a 100644
--- a/desktop/public/scenes/ui-text-rect.esscene
+++ b/desktop/public/scenes/ui-text-rect.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "SDF Text in UIRect",
"entities": [
{
diff --git a/desktop/public/scenes/ui-text-sdf.esscene b/desktop/public/scenes/ui-text-sdf.esscene
index 065a53a0a..3c7d6ec15 100644
--- a/desktop/public/scenes/ui-text-sdf.esscene
+++ b/desktop/public/scenes/ui-text-sdf.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "SDF Text Verify",
"entities": [
{
diff --git a/desktop/public/scenes/ui-text-uinode.esscene b/desktop/public/scenes/ui-text-uinode.esscene
index 699b681f7..e29fd6578 100644
--- a/desktop/public/scenes/ui-text-uinode.esscene
+++ b/desktop/public/scenes/ui-text-uinode.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Text laid out in a UINode box (REARCH_GUI S1)",
"entities": [
{
diff --git a/desktop/public/scenes/ui-text-zorder.esscene b/desktop/public/scenes/ui-text-zorder.esscene
index ece1d706e..ded9be8c2 100644
--- a/desktop/public/scenes/ui-text-zorder.esscene
+++ b/desktop/public/scenes/ui-text-zorder.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "SDF Text z-order over UI",
"entities": [
{
diff --git a/desktop/public/scenes/ui-textinput.esscene b/desktop/public/scenes/ui-textinput.esscene
index 95a08741a..3fd232845 100644
--- a/desktop/public/scenes/ui-textinput.esscene
+++ b/desktop/public/scenes/ui-textinput.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "SDF TextInput (REARCH_GUI F8)",
"entities": [
{
diff --git a/desktop/public/scenes/ui-visual-filled.esscene b/desktop/public/scenes/ui-visual-filled.esscene
index f7950d2f0..8841c3c99 100644
--- a/desktop/public/scenes/ui-visual-filled.esscene
+++ b/desktop/public/scenes/ui-visual-filled.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "UIVisual Filled — geometry+UV crop reveals a solid/textured fill along fillMethod/fillOrigin (progress/slider basis)",
"entities": [
{
diff --git a/desktop/public/scenes/video-playback.esscene b/desktop/public/scenes/video-playback.esscene
index 7a8d9da1e..8ea50cdda 100644
--- a/desktop/public/scenes/video-playback.esscene
+++ b/desktop/public/scenes/video-playback.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "VideoPlayback",
"entities": [
{
diff --git a/desktop/public/scenes/video-ui.esscene b/desktop/public/scenes/video-ui.esscene
index 419ecf137..2eb400e29 100644
--- a/desktop/public/scenes/video-ui.esscene
+++ b/desktop/public/scenes/video-ui.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "VideoUI",
"entities": [
{
diff --git a/desktop/public/scenes/ysort.esscene b/desktop/public/scenes/ysort.esscene
index f438d16af..c1bc56dd5 100644
--- a/desktop/public/scenes/ysort.esscene
+++ b/desktop/public/scenes/ysort.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "YSort",
"entities": [
{
diff --git a/desktop/templates/2d-platformer/assets/scenes/main.esscene b/desktop/templates/2d-platformer/assets/scenes/main.esscene
index 458a22eba..fc0aeb360 100644
--- a/desktop/templates/2d-platformer/assets/scenes/main.esscene
+++ b/desktop/templates/2d-platformer/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"folders": [
"Environment",
diff --git a/desktop/templates/blank/assets/scenes/main.esscene b/desktop/templates/blank/assets/scenes/main.esscene
index 6d374d4ff..5d8d274c7 100644
--- a/desktop/templates/blank/assets/scenes/main.esscene
+++ b/desktop/templates/blank/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/templates/pixel-rpg/assets/scenes/main.esscene b/desktop/templates/pixel-rpg/assets/scenes/main.esscene
index 76b30da1d..5eb7bff17 100644
--- a/desktop/templates/pixel-rpg/assets/scenes/main.esscene
+++ b/desktop/templates/pixel-rpg/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/templates/playable-ad/assets/scenes/main.esscene b/desktop/templates/playable-ad/assets/scenes/main.esscene
index 4ad838a94..250ecd1a9 100644
--- a/desktop/templates/playable-ad/assets/scenes/main.esscene
+++ b/desktop/templates/playable-ad/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/templates/top-down/assets/scenes/main.esscene b/desktop/templates/top-down/assets/scenes/main.esscene
index b3356c98a..760e27faf 100644
--- a/desktop/templates/top-down/assets/scenes/main.esscene
+++ b/desktop/templates/top-down/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"folders": [
"Level"
diff --git a/desktop/templates/ui-game/assets/scenes/main.esscene b/desktop/templates/ui-game/assets/scenes/main.esscene
index b6ae3b925..2cf3ed5ac 100644
--- a/desktop/templates/ui-game/assets/scenes/main.esscene
+++ b/desktop/templates/ui-game/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/desktop/templates/wechat-minigame/assets/scenes/main.esscene b/desktop/templates/wechat-minigame/assets/scenes/main.esscene
index e3cabaf78..d61d14d53 100644
--- a/desktop/templates/wechat-minigame/assets/scenes/main.esscene
+++ b/desktop/templates/wechat-minigame/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.json
index e5b010302..04fb75512 100644
--- a/docs/astro/src/data/apiStability.generated.json
+++ b/docs/astro/src/data/apiStability.generated.json
@@ -3,10 +3,10 @@
"counts": {
"public": 112,
"beta": 60,
- "experimental": 1501,
+ "experimental": 1507,
"deprecated": 3
},
- "total": 1673,
+ "total": 1679,
"subsystems": [
{
"id": "ecs",
diff --git a/examples/audio-demo/assets/scenes/main.esscene b/examples/audio-demo/assets/scenes/main.esscene
index 66aa0c84f..1fdcf35e9 100644
--- a/examples/audio-demo/assets/scenes/main.esscene
+++ b/examples/audio-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/camera-follow/assets/scenes/main.esscene b/examples/camera-follow/assets/scenes/main.esscene
index 222633051..b9f8fb5e8 100644
--- a/examples/camera-follow/assets/scenes/main.esscene
+++ b/examples/camera-follow/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/celestial-heights/assets/scenes/hud.esscene b/examples/celestial-heights/assets/scenes/hud.esscene
index d669cf1c6..1d9982968 100644
--- a/examples/celestial-heights/assets/scenes/hud.esscene
+++ b/examples/celestial-heights/assets/scenes/hud.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "hud",
"folders": [],
"entities": [
diff --git a/examples/celestial-heights/assets/scenes/main.esscene b/examples/celestial-heights/assets/scenes/main.esscene
index 2485a7c02..a82b9e772 100644
--- a/examples/celestial-heights/assets/scenes/main.esscene
+++ b/examples/celestial-heights/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "main",
"folders": [
"Environment",
diff --git a/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
index ace8f1bcd..c0aede751 100644
--- a/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
+++ b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "moonlit-gallery",
"folders": [
"Environment",
diff --git a/examples/celestial-heights/assets/scenes/spire.esscene b/examples/celestial-heights/assets/scenes/spire.esscene
index 1b3f15957..9d3fc1ebd 100644
--- a/examples/celestial-heights/assets/scenes/spire.esscene
+++ b/examples/celestial-heights/assets/scenes/spire.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "spire",
"folders": [
"Environment",
diff --git a/examples/chat/assets/scenes/main.esscene b/examples/chat/assets/scenes/main.esscene
index 07abd022c..d1703fea9 100644
--- a/examples/chat/assets/scenes/main.esscene
+++ b/examples/chat/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/collision-layers/assets/scenes/main.esscene b/examples/collision-layers/assets/scenes/main.esscene
index 05bda05c7..ef3115c1f 100644
--- a/examples/collision-layers/assets/scenes/main.esscene
+++ b/examples/collision-layers/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/cutscene/assets/scenes/main.esscene b/examples/cutscene/assets/scenes/main.esscene
index 79e0cd697..5a91b95e8 100644
--- a/examples/cutscene/assets/scenes/main.esscene
+++ b/examples/cutscene/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/dragonbones-demo/assets/scenes/main.esscene b/examples/dragonbones-demo/assets/scenes/main.esscene
index 95329fd88..e6e9604dd 100644
--- a/examples/dragonbones-demo/assets/scenes/main.esscene
+++ b/examples/dragonbones-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "DragonBonesDemo",
"entities": [
{
diff --git a/examples/drawing-demo/assets/scenes/main.esscene b/examples/drawing-demo/assets/scenes/main.esscene
index 89a52249f..3fa8cb142 100644
--- a/examples/drawing-demo/assets/scenes/main.esscene
+++ b/examples/drawing-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/ecs-basics/assets/scenes/main.esscene b/examples/ecs-basics/assets/scenes/main.esscene
index 6d374d4ff..5d8d274c7 100644
--- a/examples/ecs-basics/assets/scenes/main.esscene
+++ b/examples/ecs-basics/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/effects-gallery/assets/scenes/main.esscene b/examples/effects-gallery/assets/scenes/main.esscene
index fefccc7ee..67a0c076c 100644
--- a/examples/effects-gallery/assets/scenes/main.esscene
+++ b/examples/effects-gallery/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/enemy-ai/assets/scenes/main.esscene b/examples/enemy-ai/assets/scenes/main.esscene
index 66d0ea6dc..915a69723 100644
--- a/examples/enemy-ai/assets/scenes/main.esscene
+++ b/examples/enemy-ai/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/event-system/assets/scenes/main.esscene b/examples/event-system/assets/scenes/main.esscene
index 6d374d4ff..5d8d274c7 100644
--- a/examples/event-system/assets/scenes/main.esscene
+++ b/examples/event-system/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/hello-world/assets/scenes/main.esscene b/examples/hello-world/assets/scenes/main.esscene
index 8aa27e4bb..24488ff42 100644
--- a/examples/hello-world/assets/scenes/main.esscene
+++ b/examples/hello-world/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/hot-update-demo/assets/scenes/main.esscene b/examples/hot-update-demo/assets/scenes/main.esscene
index feebd706b..c83e281a6 100644
--- a/examples/hot-update-demo/assets/scenes/main.esscene
+++ b/examples/hot-update-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/input-actions/assets/scenes/main.esscene b/examples/input-actions/assets/scenes/main.esscene
index 9bc9e4901..2133702ae 100644
--- a/examples/input-actions/assets/scenes/main.esscene
+++ b/examples/input-actions/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/input-demo/assets/scenes/main.esscene b/examples/input-demo/assets/scenes/main.esscene
index 18fd1704c..bc457cd7d 100644
--- a/examples/input-demo/assets/scenes/main.esscene
+++ b/examples/input-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/lighting-2d/assets/scenes/main.esscene b/examples/lighting-2d/assets/scenes/main.esscene
index 743e8706f..abecd5917 100644
--- a/examples/lighting-2d/assets/scenes/main.esscene
+++ b/examples/lighting-2d/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/multiplayer-arena/assets/scenes/main.esscene b/examples/multiplayer-arena/assets/scenes/main.esscene
index 192c2de2b..6a76fb938 100644
--- a/examples/multiplayer-arena/assets/scenes/main.esscene
+++ b/examples/multiplayer-arena/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/particle-demo/assets/scenes/main.esscene b/examples/particle-demo/assets/scenes/main.esscene
index b6ffd8ea4..e43fb2e14 100644
--- a/examples/particle-demo/assets/scenes/main.esscene
+++ b/examples/particle-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/particle-demo/assets/scenes/static-emitters.esscene b/examples/particle-demo/assets/scenes/static-emitters.esscene
index d64c934c6..7e0a288c1 100644
--- a/examples/particle-demo/assets/scenes/static-emitters.esscene
+++ b/examples/particle-demo/assets/scenes/static-emitters.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Static Emitters",
"entities": [
{
diff --git a/examples/physics-playground/assets/scenes/main.esscene b/examples/physics-playground/assets/scenes/main.esscene
index 7a941b894..4b1ff522d 100644
--- a/examples/physics-playground/assets/scenes/main.esscene
+++ b/examples/physics-playground/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/physics-playground/assets/scenes/showcase.esscene b/examples/physics-playground/assets/scenes/showcase.esscene
index 3f62a81d1..e9a858ecc 100644
--- a/examples/physics-playground/assets/scenes/showcase.esscene
+++ b/examples/physics-playground/assets/scenes/showcase.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Showcase",
"entities": [
{
diff --git a/examples/physics-spinner/assets/scenes/main.esscene b/examples/physics-spinner/assets/scenes/main.esscene
index 46c02b7d5..9be5874a3 100644
--- a/examples/physics-spinner/assets/scenes/main.esscene
+++ b/examples/physics-spinner/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/platformer/assets/scenes/main.esscene b/examples/platformer/assets/scenes/main.esscene
index 458a22eba..fc0aeb360 100644
--- a/examples/platformer/assets/scenes/main.esscene
+++ b/examples/platformer/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"folders": [
"Environment",
diff --git a/examples/postprocess-effects/assets/scenes/main.esscene b/examples/postprocess-effects/assets/scenes/main.esscene
index 8489412f0..34d01fc5c 100644
--- a/examples/postprocess-effects/assets/scenes/main.esscene
+++ b/examples/postprocess-effects/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/render-texture/assets/scenes/main.esscene b/examples/render-texture/assets/scenes/main.esscene
index 222633051..b9f8fb5e8 100644
--- a/examples/render-texture/assets/scenes/main.esscene
+++ b/examples/render-texture/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/rich-text/assets/scenes/main.esscene b/examples/rich-text/assets/scenes/main.esscene
index 6942d7e71..bab463788 100644
--- a/examples/rich-text/assets/scenes/main.esscene
+++ b/examples/rich-text/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/save-load/assets/scenes/main.esscene b/examples/save-load/assets/scenes/main.esscene
index 9eb9294e4..7be919d95 100644
--- a/examples/save-load/assets/scenes/main.esscene
+++ b/examples/save-load/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/scene-flow/assets/scenes/main.esscene b/examples/scene-flow/assets/scenes/main.esscene
index 1bee22aef..0b35dddb6 100644
--- a/examples/scene-flow/assets/scenes/main.esscene
+++ b/examples/scene-flow/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/space-shooter/assets/scenes/main.esscene b/examples/space-shooter/assets/scenes/main.esscene
index 25e032826..120aa68e2 100644
--- a/examples/space-shooter/assets/scenes/main.esscene
+++ b/examples/space-shooter/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/spine-demo/assets/scenes/aran.esscene b/examples/spine-demo/assets/scenes/aran.esscene
index 5a3431375..5fd3ee7bd 100644
--- a/examples/spine-demo/assets/scenes/aran.esscene
+++ b/examples/spine-demo/assets/scenes/aran.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "AranShowcase",
"entities": [
{
diff --git a/examples/spine-demo/assets/scenes/main.esscene b/examples/spine-demo/assets/scenes/main.esscene
index 5be74714a..797c1ea82 100644
--- a/examples/spine-demo/assets/scenes/main.esscene
+++ b/examples/spine-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "SpineDemo",
"entities": [
{
diff --git a/examples/sprite-animation/assets/scenes/coins.esscene b/examples/sprite-animation/assets/scenes/coins.esscene
index 1873705ca..e6131a97f 100644
--- a/examples/sprite-animation/assets/scenes/coins.esscene
+++ b/examples/sprite-animation/assets/scenes/coins.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Coins",
"entities": [
{
diff --git a/examples/sprite-animation/assets/scenes/main.esscene b/examples/sprite-animation/assets/scenes/main.esscene
index f64d4e1b4..5b8471f6e 100644
--- a/examples/sprite-animation/assets/scenes/main.esscene
+++ b/examples/sprite-animation/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/sprite-rendering/assets/scenes/main.esscene b/examples/sprite-rendering/assets/scenes/main.esscene
index 505f890f3..fa3f71c01 100644
--- a/examples/sprite-rendering/assets/scenes/main.esscene
+++ b/examples/sprite-rendering/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/hex-map.esscene b/examples/tilemap-demo/assets/scenes/hex-map.esscene
index bbbd0a3e1..92d490c52 100644
--- a/examples/tilemap-demo/assets/scenes/hex-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/hex-map.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/iso-map.esscene b/examples/tilemap-demo/assets/scenes/iso-map.esscene
index 86b079f9f..2087698d1 100644
--- a/examples/tilemap-demo/assets/scenes/iso-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/iso-map.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/native-map.esscene b/examples/tilemap-demo/assets/scenes/native-map.esscene
index 3eedab4d6..47f952a35 100644
--- a/examples/tilemap-demo/assets/scenes/native-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/native-map.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "NativeMap",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/staggered-map.esscene b/examples/tilemap-demo/assets/scenes/staggered-map.esscene
index b3b10d7c9..91c65a017 100644
--- a/examples/tilemap-demo/assets/scenes/staggered-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/staggered-map.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/tiled-map.esscene b/examples/tilemap-demo/assets/scenes/tiled-map.esscene
index b6b77110b..97b978664 100644
--- a/examples/tilemap-demo/assets/scenes/tiled-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/tiled-map.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "TiledMap",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/wang-map.esscene b/examples/tilemap-demo/assets/scenes/wang-map.esscene
index d77240ef7..70b9b6140 100644
--- a/examples/tilemap-demo/assets/scenes/wang-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/wang-map.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/timers-demo/assets/scenes/main.esscene b/examples/timers-demo/assets/scenes/main.esscene
index fd4c3bee8..3c2ed143f 100644
--- a/examples/timers-demo/assets/scenes/main.esscene
+++ b/examples/timers-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/trail-demo/assets/scenes/main.esscene b/examples/trail-demo/assets/scenes/main.esscene
index 1ef688fd6..8b627a41b 100644
--- a/examples/trail-demo/assets/scenes/main.esscene
+++ b/examples/trail-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/tween-animation/assets/scenes/main.esscene b/examples/tween-animation/assets/scenes/main.esscene
index 3f75b9e22..901176f68 100644
--- a/examples/tween-animation/assets/scenes/main.esscene
+++ b/examples/tween-animation/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-controller/assets/scenes/authoring.esscene b/examples/ui-controller/assets/scenes/authoring.esscene
index c97ba6132..436afc867 100644
--- a/examples/ui-controller/assets/scenes/authoring.esscene
+++ b/examples/ui-controller/assets/scenes/authoring.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "UI Controllers & Gears",
"entities": [
{
diff --git a/examples/ui-controller/assets/scenes/main.esscene b/examples/ui-controller/assets/scenes/main.esscene
index f51af7bd4..3c5158f33 100644
--- a/examples/ui-controller/assets/scenes/main.esscene
+++ b/examples/ui-controller/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-controls/assets/scenes/main.esscene b/examples/ui-controls/assets/scenes/main.esscene
index 886e48f5b..c82186ad5 100644
--- a/examples/ui-controls/assets/scenes/main.esscene
+++ b/examples/ui-controls/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-events/assets/scenes/main.esscene b/examples/ui-events/assets/scenes/main.esscene
index 941265017..23849aa45 100644
--- a/examples/ui-events/assets/scenes/main.esscene
+++ b/examples/ui-events/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "UI Events (no code)",
"entities": [
{
diff --git a/examples/ui-interaction/assets/scenes/main.esscene b/examples/ui-interaction/assets/scenes/main.esscene
index d5aae1ba8..3919cab9f 100644
--- a/examples/ui-interaction/assets/scenes/main.esscene
+++ b/examples/ui-interaction/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-layout/assets/scenes/main.esscene b/examples/ui-layout/assets/scenes/main.esscene
index ff7cb1d74..f95011bff 100644
--- a/examples/ui-layout/assets/scenes/main.esscene
+++ b/examples/ui-layout/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-list/assets/scenes/main.esscene b/examples/ui-list/assets/scenes/main.esscene
index 6a74d4da4..ad75cbb8b 100644
--- a/examples/ui-list/assets/scenes/main.esscene
+++ b/examples/ui-list/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/video-playback/assets/scenes/main.esscene b/examples/video-playback/assets/scenes/main.esscene
index aa0c76b82..a57cbb2d9 100644
--- a/examples/video-playback/assets/scenes/main.esscene
+++ b/examples/video-playback/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/examples/video-puzzle/assets/scenes/main.esscene b/examples/video-puzzle/assets/scenes/main.esscene
index 31e1d0d85..d3d42fef8 100644
--- a/examples/video-puzzle/assets/scenes/main.esscene
+++ b/examples/video-puzzle/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": "1.0",
+ "version": 1,
"name": "Main",
"entities": [
{
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index 28646dd4a..cb49fb73b 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 112 public · 53 beta · 1386 experimental · 3 deprecated
+Symbols: 112 public · 53 beta · 1392 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
@@ -2373,6 +2373,33 @@ ComponentDef<{}>
ComponentDef<DistanceJointData>
```
+## DocumentDiagnostic — interface @experimental
+```
+code: string
+entityId: DocumentEntityId | undefined
+field: string | undefined
+message: string
+severity: DocumentDiagnosticSeverity
+```
+
+## DocumentDiagnosticSeverity — type @experimental
+```
+'error' | 'warning'
+```
+
+## DocumentEntityId — type @experimental
+```
+string | number
+```
+
+## DocumentNode — interface @experimental
+```
+children: readonly DocumentEntityId[]
+components: readonly { type: string; data: Record<string, unknown>; }[]
+id: DocumentEntityId
+parent: DocumentEntityId | null
+```
+
## DragPlugin — class @experimental
```
build: (app: App) => void
@@ -5305,18 +5332,14 @@ rootEntityId: string
version: string
```
-## PrefabDiagnostic — interface @experimental
+## PrefabDiagnostic — type @experimental
```
-code: string
-entityId: string | undefined
-field: string | undefined
-message: string
-severity: PrefabDiagnosticSeverity
+DocumentDiagnostic
```
## PrefabDiagnosticSeverity — type @experimental
```
-'error' | 'warning'
+DocumentDiagnosticSeverity
```
## PrefabEntityData — interface @experimental
@@ -10805,6 +10828,11 @@ SafeAreaPlugin
{ readonly clamp: (x: number, min: number, max: number) => number; readonly clamp01: (x: number) => number; readonly lerp: (a: number, b: number, t: number) => number; readonly inverseLerp: (a: number, b: number, value: number) => number; readonly remap: (value: number, inMin: number, inMax: number, outMin: number, outMax: number) => number; readonly deg2rad: (deg: number) => number; readonly rad2deg: (rad: number) => number; readonly approximately: (a: number, b: number, epsilon?: number) => boolean; readonly smoothstep: (edge0: number, edge1: number, x: number) => number; readonly mod: (x: number, n: number) => number; readonly sign: (x: number) => number; }
```
+## sceneErrors — const @experimental
+```
+(diags: readonly DocumentDiagnostic[]) => DocumentDiagnostic[]
+```
+
## sceneManagerPlugin — const @experimental
```
Plugin
@@ -11360,6 +11388,11 @@ UIVisibilityPlugin
(prefab: PrefabData, options?: ValidatePrefabOptions): PrefabDiagnostic[]
```
+## validateScene — function @experimental
+```
+(scene: SceneData): DocumentDiagnostic[]
+```
+
## vec2 — const @experimental
```
(x?: number, y?: number) => Vec2
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index bdb5a3f95..236eb45c5 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.native
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 112 public · 58 beta · 1405 experimental · 3 deprecated
+Symbols: 112 public · 58 beta · 1411 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
@@ -2381,6 +2381,33 @@ ComponentDef<{}>
ComponentDef<DistanceJointData>
```
+## DocumentDiagnostic — interface @experimental
+```
+code: string
+entityId: DocumentEntityId | undefined
+field: string | undefined
+message: string
+severity: DocumentDiagnosticSeverity
+```
+
+## DocumentDiagnosticSeverity — type @experimental
+```
+'error' | 'warning'
+```
+
+## DocumentEntityId — type @experimental
+```
+string | number
+```
+
+## DocumentNode — interface @experimental
+```
+children: readonly DocumentEntityId[]
+components: readonly { type: string; data: Record<string, unknown>; }[]
+id: DocumentEntityId
+parent: DocumentEntityId | null
+```
+
## DragPlugin — class @experimental
```
build: (app: App) => void
@@ -5488,18 +5515,14 @@ rootEntityId: string
version: string
```
-## PrefabDiagnostic — interface @experimental
+## PrefabDiagnostic — type @experimental
```
-code: string
-entityId: string | undefined
-field: string | undefined
-message: string
-severity: PrefabDiagnosticSeverity
+DocumentDiagnostic
```
## PrefabDiagnosticSeverity — type @experimental
```
-'error' | 'warning'
+DocumentDiagnosticSeverity
```
## PrefabEntityData — interface @experimental
@@ -11048,6 +11071,11 @@ SafeAreaPlugin
{ readonly clamp: (x: number, min: number, max: number) => number; readonly clamp01: (x: number) => number; readonly lerp: (a: number, b: number, t: number) => number; readonly inverseLerp: (a: number, b: number, value: number) => number; readonly remap: (value: number, inMin: number, inMax: number, outMin: number, outMax: number) => number; readonly deg2rad: (deg: number) => number; readonly rad2deg: (rad: number) => number; readonly approximately: (a: number, b: number, epsilon?: number) => boolean; readonly smoothstep: (edge0: number, edge1: number, x: number) => number; readonly mod: (x: number, n: number) => number; readonly sign: (x: number) => number; }
```
+## sceneErrors — const @experimental
+```
+(diags: readonly DocumentDiagnostic[]) => DocumentDiagnostic[]
+```
+
## sceneManagerPlugin — const @experimental
```
Plugin
@@ -11603,6 +11631,11 @@ UIVisibilityPlugin
(prefab: PrefabData, options?: ValidatePrefabOptions): PrefabDiagnostic[]
```
+## validateScene — function @experimental
+```
+(scene: SceneData): DocumentDiagnostic[]
+```
+
## vec2 — const @experimental
```
(x?: number, y?: number) => Vec2
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index 959f5c43d..4ecff6ebe 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.node
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 112 public · 55 beta · 1385 experimental · 3 deprecated
+Symbols: 112 public · 55 beta · 1391 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -2368,6 +2368,33 @@ ComponentDef<{}>
ComponentDef<DistanceJointData>
```
+## DocumentDiagnostic — interface @experimental
+```
+code: string
+entityId: DocumentEntityId | undefined
+field: string | undefined
+message: string
+severity: DocumentDiagnosticSeverity
+```
+
+## DocumentDiagnosticSeverity — type @experimental
+```
+'error' | 'warning'
+```
+
+## DocumentEntityId — type @experimental
+```
+string | number
+```
+
+## DocumentNode — interface @experimental
+```
+children: readonly DocumentEntityId[]
+components: readonly { type: string; data: Record<string, unknown>; }[]
+id: DocumentEntityId
+parent: DocumentEntityId | null
+```
+
## DragPlugin — class @experimental
```
build: (app: App) => void
@@ -5300,18 +5327,14 @@ rootEntityId: string
version: string
```
-## PrefabDiagnostic — interface @experimental
+## PrefabDiagnostic — type @experimental
```
-code: string
-entityId: string | undefined
-field: string | undefined
-message: string
-severity: PrefabDiagnosticSeverity
+DocumentDiagnostic
```
## PrefabDiagnosticSeverity — type @experimental
```
-'error' | 'warning'
+DocumentDiagnosticSeverity
```
## PrefabEntityData — interface @experimental
@@ -10810,6 +10833,11 @@ SafeAreaPlugin
{ readonly clamp: (x: number, min: number, max: number) => number; readonly clamp01: (x: number) => number; readonly lerp: (a: number, b: number, t: number) => number; readonly inverseLerp: (a: number, b: number, value: number) => number; readonly remap: (value: number, inMin: number, inMax: number, outMin: number, outMax: number) => number; readonly deg2rad: (deg: number) => number; readonly rad2deg: (rad: number) => number; readonly approximately: (a: number, b: number, epsilon?: number) => boolean; readonly smoothstep: (edge0: number, edge1: number, x: number) => number; readonly mod: (x: number, n: number) => number; readonly sign: (x: number) => number; }
```
+## sceneErrors — const @experimental
+```
+(diags: readonly DocumentDiagnostic[]) => DocumentDiagnostic[]
+```
+
## sceneManagerPlugin — const @experimental
```
Plugin
@@ -11365,6 +11393,11 @@ UIVisibilityPlugin
(prefab: PrefabData, options?: ValidatePrefabOptions): PrefabDiagnostic[]
```
+## validateScene — function @experimental
+```
+(scene: SceneData): DocumentDiagnostic[]
+```
+
## vec2 — const @experimental
```
(x?: number, y?: number) => Vec2
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index ed42f542e..726bd3824 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/minigame
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 112 public · 53 beta · 1406 experimental · 3 deprecated
+Symbols: 112 public · 53 beta · 1412 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -2368,6 +2368,33 @@ ComponentDef<{}>
ComponentDef<DistanceJointData>
```
+## DocumentDiagnostic — interface @experimental
+```
+code: string
+entityId: DocumentEntityId | undefined
+field: string | undefined
+message: string
+severity: DocumentDiagnosticSeverity
+```
+
+## DocumentDiagnosticSeverity — type @experimental
+```
+'error' | 'warning'
+```
+
+## DocumentEntityId — type @experimental
+```
+string | number
+```
+
+## DocumentNode — interface @experimental
+```
+children: readonly DocumentEntityId[]
+components: readonly { type: string; data: Record<string, unknown>; }[]
+id: DocumentEntityId
+parent: DocumentEntityId | null
+```
+
## DragPlugin — class @experimental
```
build: (app: App) => void
@@ -5545,18 +5572,14 @@ rootEntityId: string
version: string
```
-## PrefabDiagnostic — interface @experimental
+## PrefabDiagnostic — type @experimental
```
-code: string
-entityId: string | undefined
-field: string | undefined
-message: string
-severity: PrefabDiagnosticSeverity
+DocumentDiagnostic
```
## PrefabDiagnosticSeverity — type @experimental
```
-'error' | 'warning'
+DocumentDiagnosticSeverity
```
## PrefabEntityData — interface @experimental
@@ -11060,6 +11083,11 @@ SafeAreaPlugin
{ readonly clamp: (x: number, min: number, max: number) => number; readonly clamp01: (x: number) => number; readonly lerp: (a: number, b: number, t: number) => number; readonly inverseLerp: (a: number, b: number, value: number) => number; readonly remap: (value: number, inMin: number, inMax: number, outMin: number, outMax: number) => number; readonly deg2rad: (deg: number) => number; readonly rad2deg: (rad: number) => number; readonly approximately: (a: number, b: number, epsilon?: number) => boolean; readonly smoothstep: (edge0: number, edge1: number, x: number) => number; readonly mod: (x: number, n: number) => number; readonly sign: (x: number) => number; }
```
+## sceneErrors — const @experimental
+```
+(diags: readonly DocumentDiagnostic[]) => DocumentDiagnostic[]
+```
+
## sceneManagerPlugin — const @experimental
```
Plugin
@@ -11615,6 +11643,11 @@ UIVisibilityPlugin
(prefab: PrefabData, options?: ValidatePrefabOptions): PrefabDiagnostic[]
```
+## validateScene — function @experimental
+```
+(scene: SceneData): DocumentDiagnostic[]
+```
+
## vec2 — const @experimental
```
(x?: number, y?: number) => Vec2
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index 4f195b938..2db1e094f 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/wechat
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 112 public · 53 beta · 1396 experimental · 3 deprecated
+Symbols: 112 public · 53 beta · 1402 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -2368,6 +2368,33 @@ ComponentDef<{}>
ComponentDef<DistanceJointData>
```
+## DocumentDiagnostic — interface @experimental
+```
+code: string
+entityId: DocumentEntityId | undefined
+field: string | undefined
+message: string
+severity: DocumentDiagnosticSeverity
+```
+
+## DocumentDiagnosticSeverity — type @experimental
+```
+'error' | 'warning'
+```
+
+## DocumentEntityId — type @experimental
+```
+string | number
+```
+
+## DocumentNode — interface @experimental
+```
+children: readonly DocumentEntityId[]
+components: readonly { type: string; data: Record<string, unknown>; }[]
+id: DocumentEntityId
+parent: DocumentEntityId | null
+```
+
## DragPlugin — class @experimental
```
build: (app: App) => void
@@ -5307,18 +5334,14 @@ rootEntityId: string
version: string
```
-## PrefabDiagnostic — interface @experimental
+## PrefabDiagnostic — type @experimental
```
-code: string
-entityId: string | undefined
-field: string | undefined
-message: string
-severity: PrefabDiagnosticSeverity
+DocumentDiagnostic
```
## PrefabDiagnosticSeverity — type @experimental
```
-'error' | 'warning'
+DocumentDiagnosticSeverity
```
## PrefabEntityData — interface @experimental
@@ -10832,6 +10855,11 @@ SafeAreaPlugin
{ readonly clamp: (x: number, min: number, max: number) => number; readonly clamp01: (x: number) => number; readonly lerp: (a: number, b: number, t: number) => number; readonly inverseLerp: (a: number, b: number, value: number) => number; readonly remap: (value: number, inMin: number, inMax: number, outMin: number, outMax: number) => number; readonly deg2rad: (deg: number) => number; readonly rad2deg: (rad: number) => number; readonly approximately: (a: number, b: number, epsilon?: number) => boolean; readonly smoothstep: (edge0: number, edge1: number, x: number) => number; readonly mod: (x: number, n: number) => number; readonly sign: (x: number) => number; }
```
+## sceneErrors — const @experimental
+```
+(diags: readonly DocumentDiagnostic[]) => DocumentDiagnostic[]
+```
+
## sceneManagerPlugin — const @experimental
```
Plugin
@@ -11387,6 +11415,11 @@ UIVisibilityPlugin
(prefab: PrefabData, options?: ValidatePrefabOptions): PrefabDiagnostic[]
```
+## validateScene — function @experimental
+```
+(scene: SceneData): DocumentDiagnostic[]
+```
+
## vec2 — const @experimental
```
(x?: number, y?: number) => Vec2
diff --git a/sdk/src/core-content.ts b/sdk/src/core-content.ts
index d9245dd41..1fc06d47e 100644
--- a/sdk/src/core-content.ts
+++ b/sdk/src/core-content.ts
@@ -142,6 +142,20 @@ export {
type SliceBorder,
} from './scene/scene';
+/**
+ * Structural problems in an authored document, in one vocabulary for scenes and
+ * prefabs alike — what every gate that reads one judges by.
+ *
+ * @experimental Pre-1.0: diagnostic codes may gain members as checks are added.
+ */
+export { validateScene, sceneErrors } from './scene/validateScene';
+export type {
+ DocumentDiagnostic,
+ DocumentDiagnosticSeverity,
+ DocumentEntityId,
+ DocumentNode,
+} from './document/diagnostics';
+
/**
* Every asset a scene references, bucketed by declared type — the input to
* releasing what a document acquired.
diff --git a/sdk/src/document/diagnostics.ts b/sdk/src/document/diagnostics.ts
new file mode 100644
index 000000000..4d79d996c
--- /dev/null
+++ b/sdk/src/document/diagnostics.ts
@@ -0,0 +1,181 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file What is wrong with an authored document, said the same way for all of
+ * them.
+ *
+ * A scene and a prefab are the same shape of thing — entities with ids,
+ * a parent/children topology, components, references between them — and
+ * break in the same ways. The checks that find those breaks belong to
+ * neither format: they take a view of the document and return findings,
+ * so every gate that reads one (editor open, runtime load, cook, CI)
+ * judges by the same rules.
+ *
+ * Pure and total: nothing here throws. The caller decides what a finding
+ * costs.
+ */
+import { getComponent } from '../ecs/component';
+
+/** An id as an authored document spells it. Scenes count; prefabs name. */
+export type DocumentEntityId = string | number;
+
+export type DocumentDiagnosticSeverity = 'error' | 'warning';
+
+/** One structured problem found in an authored document. */
+export interface DocumentDiagnostic {
+ /** Stable machine code (kebab-case), e.g. `duplicate-id`, `parent-cycle`. */
+ code: string;
+ severity: DocumentDiagnosticSeverity;
+ /** One-line human-readable explanation. */
+ message: string;
+ /** The entity the problem is on, when applicable. */
+ entityId?: DocumentEntityId;
+ /** The component type / `Comp.field` / metadata key involved, when applicable. */
+ field?: string;
+}
+
+/** How a finding is recorded. Formats pass their own so they can add their own. */
+export type DiagnosticSink = (
+ code: string,
+ severity: DocumentDiagnosticSeverity,
+ message: string,
+ entityId?: DocumentEntityId,
+ field?: string,
+) => void;
+
+/** One entity of a document, in the terms every format shares. */
+export interface DocumentNode {
+ id: DocumentEntityId;
+ parent: DocumentEntityId | null;
+ children: readonly DocumentEntityId[];
+ components: readonly { type: string; data: Record<string, unknown> }[];
+}
+
+/** Whether a document names its entities by string or by number, for messages. */
+const quote = (id: DocumentEntityId): string => (typeof id === 'string' ? `"${id}"` : String(id));
+
+/**
+ * Ids are unique, and no entity carries the same component twice. A repeated id
+ * is the finding nothing downstream can work around: a loader keying by id keeps
+ * whichever came last, and every reference to it lands elsewhere in silence.
+ * Returns the id→node index the later passes read.
+ */
+export function checkDocumentIds(
+ nodes: readonly DocumentNode[],
+ push: DiagnosticSink,
+): Map<DocumentEntityId, DocumentNode> {
+ const byId = new Map<DocumentEntityId, DocumentNode>();
+ for (const node of nodes) {
+ if (byId.has(node.id)) {
+ push('duplicate-id', 'error', `entity id ${quote(node.id)} appears more than once`, node.id);
+ } else {
+ byId.set(node.id, node);
+ }
+ const types = new Set<string>();
+ for (const c of node.components) {
+ if (types.has(c.type)) {
+ push('duplicate-component', 'error',
+ `entity ${quote(node.id)} has more than one "${c.type}" component`, node.id, c.type);
+ } else {
+ types.add(c.type);
+ }
+ }
+ }
+ return byId;
+}
+
+/**
+ * Parent and children agree with each other, and both name entities that exist.
+ *
+ * `rootIsDetached` decides what a null parent means: a prefab has exactly one
+ * root and anything else adrift is broken, while a scene is a forest and a null
+ * parent is ordinary.
+ */
+export function checkDocumentTopology(
+ nodes: readonly DocumentNode[],
+ byId: ReadonlyMap<DocumentEntityId, DocumentNode>,
+ push: DiagnosticSink,
+): void {
+ for (const node of nodes) {
+ if (node.parent !== null) {
+ const parent = byId.get(node.parent);
+ if (!parent) {
+ push('missing-parent', 'error',
+ `entity ${quote(node.id)} parent ${quote(node.parent)} does not exist`, node.id);
+ } else if (!parent.children.includes(node.id)) {
+ push('inconsistent-topology', 'error',
+ `entity ${quote(node.id)} claims parent ${quote(node.parent)} but that parent's children omit it`, node.id);
+ }
+ }
+ for (const childId of node.children) {
+ const child = byId.get(childId);
+ if (!child) {
+ push('missing-child', 'error',
+ `entity ${quote(node.id)} lists child ${quote(childId)} which does not exist`, node.id, String(childId));
+ } else if (child.parent !== node.id) {
+ push('inconsistent-topology', 'error',
+ `entity ${quote(node.id)} lists ${quote(childId)} as a child but its parent points elsewhere`, node.id, String(childId));
+ }
+ }
+ }
+}
+
+/**
+ * No entity is its own ancestor. Reported once: a cycle otherwise names every
+ * entity on it, and the reader has to work out that it is one problem.
+ */
+export function checkParentCycle(
+ nodes: readonly DocumentNode[],
+ byId: ReadonlyMap<DocumentEntityId, DocumentNode>,
+ push: DiagnosticSink,
+): void {
+ const WHITE = 0, GRAY = 1, BLACK = 2;
+ const color = new Map<DocumentEntityId, number>();
+ for (const node of nodes) color.set(node.id, WHITE);
+ let reported = false;
+
+ const visit = (id: DocumentEntityId, path: DocumentEntityId[]): void => {
+ if (reported) return;
+ const c = color.get(id);
+ if (c === BLACK) return;
+ if (c === GRAY) {
+ const cycle = path.slice(path.indexOf(id)).concat(id).map(String).join(' → ');
+ push('parent-cycle', 'error', `parent cycle detected: ${cycle}`, id);
+ reported = true;
+ return;
+ }
+ color.set(id, GRAY);
+ const node = byId.get(id);
+ if (node && node.parent !== null && byId.has(node.parent)) visit(node.parent, [...path, id]);
+ color.set(id, BLACK);
+ };
+ for (const node of nodes) visit(node.id, []);
+}
+
+/**
+ * Entity-reference fields point at entities of this document.
+ *
+ * A warning, not an error: a reference to something the author deleted leaves a
+ * document that still loads, with one field reading empty.
+ */
+export function checkEntityRefs(
+ nodes: readonly DocumentNode[],
+ byId: ReadonlyMap<DocumentEntityId, DocumentNode>,
+ push: DiagnosticSink,
+ isEmptyRef: (value: DocumentEntityId) => boolean,
+): void {
+ for (const node of nodes) {
+ for (const c of node.components) {
+ const def = getComponent(c.type);
+ if (!def || def.entityFields.length === 0) continue;
+ for (const field of def.entityFields) {
+ const v = c.data[field];
+ if (typeof v !== 'string' && typeof v !== 'number') continue;
+ if (isEmptyRef(v) || byId.has(v)) continue;
+ push('dangling-entity-ref', 'warning',
+ `entity ${quote(node.id)} field "${c.type}.${field}" references ${quote(v)}, which is not in the document`,
+ node.id, `${c.type}.${field}`);
+ }
+ }
+ }
+}
diff --git a/sdk/src/prefab/validate.ts b/sdk/src/prefab/validate.ts
index 24278ac8c..a7ba200e6 100644
--- a/sdk/src/prefab/validate.ts
+++ b/sdk/src/prefab/validate.ts
@@ -8,6 +8,16 @@ import type {
} from './types';
import { PREFAB_ADDRESS_SEP } from './types';
import { getComponent } from '../ecs/component';
+import {
+ checkDocumentIds,
+ checkDocumentTopology,
+ checkParentCycle,
+ checkEntityRefs,
+ type DiagnosticSink,
+ type DocumentDiagnostic,
+ type DocumentDiagnosticSeverity,
+ type DocumentNode,
+} from '../document/diagnostics';
export interface StaleOverride {
override: PrefabOverride;
@@ -168,20 +178,9 @@ function reasonForOverride(
// every gate (editor open/save, runtime load, cook, CI). It never throws — it
// returns structured diagnostics so each caller decides how to surface them.
-export type PrefabDiagnosticSeverity = 'error' | 'warning';
-
-/** One structured problem found in a prefab asset. */
-export interface PrefabDiagnostic {
- /** Stable machine code (kebab-case), e.g. `duplicate-id`, `parent-cycle`. */
- code: string;
- severity: PrefabDiagnosticSeverity;
- /** One-line human-readable explanation. */
- message: string;
- /** The entity the problem is on, when applicable. */
- entityId?: PrefabEntityId;
- /** The component type / `Comp.field` / metadata key involved, when applicable. */
- field?: string;
-}
+/** A prefab's findings are document findings; the name is kept for its readers. */
+export type PrefabDiagnosticSeverity = DocumentDiagnosticSeverity;
+export type PrefabDiagnostic = DocumentDiagnostic;
export interface ValidatePrefabOptions {
/** Resolver for nested / variant dependency + nested-override checks. */
@@ -190,6 +189,14 @@ export interface ValidatePrefabOptions {
instanceOverrides?: readonly PrefabOverride[];
}
+/** A prefab entity as the shared checks read it. */
+const prefabNode = (e: PrefabEntityData): DocumentNode => ({
+ id: e.prefabEntityId,
+ parent: e.parent,
+ children: e.children,
+ components: e.components,
+});
+
/**
* Validate a prefab asset end-to-end and return every problem found. Errors mean
* the prefab is structurally broken (flatten would misbehave or throw); warnings
@@ -200,13 +207,7 @@ export function validatePrefab(
options?: ValidatePrefabOptions,
): PrefabDiagnostic[] {
const diags: PrefabDiagnostic[] = [];
- const push = (
- code: string,
- severity: PrefabDiagnosticSeverity,
- message: string,
- entityId?: PrefabEntityId,
- field?: string,
- ): void => {
+ const push: DiagnosticSink = (code, severity, message, entityId, field): void => {
diags.push({
code,
severity,
@@ -216,28 +217,17 @@ export function validatePrefab(
});
};
- // Pass 1: id integrity + per-entity component-type uniqueness.
+ // Pass 1: id integrity + per-entity component-type uniqueness, plus the one
+ // rule only a prefab has — its ids address nested entities, so an id that
+ // contains the address separator cannot be addressed at all.
+ const nodes: DocumentNode[] = prefab.entities.map(prefabNode);
+ const nodeById = checkDocumentIds(nodes, push);
const byId = new Map<PrefabEntityId, PrefabEntityData>();
- const seen = new Set<PrefabEntityId>();
for (const e of prefab.entities) {
if (e.prefabEntityId.includes(PREFAB_ADDRESS_SEP)) {
push('invalid-id', 'error', `entity id "${e.prefabEntityId}" contains the reserved separator "${PREFAB_ADDRESS_SEP}"`, e.prefabEntityId);
}
- if (seen.has(e.prefabEntityId)) {
- push('duplicate-id', 'error', `entity id "${e.prefabEntityId}" appears more than once`, e.prefabEntityId);
- } else {
- seen.add(e.prefabEntityId);
- }
byId.set(e.prefabEntityId, e);
-
- const compTypes = new Set<string>();
- for (const c of e.components) {
- if (compTypes.has(c.type)) {
- push('duplicate-component', 'error', `entity "${e.prefabEntityId}" has more than one "${c.type}" component`, e.prefabEntityId, c.type);
- } else {
- compTypes.add(c.type);
- }
- }
}
// Pass 2: root existence (exactly one, referenced by rootEntityId).
@@ -245,32 +235,17 @@ export function validatePrefab(
push('root-missing', 'error', `rootEntityId "${prefab.rootEntityId}" is not an entity in the prefab`, prefab.rootEntityId);
}
- // Pass 3: topology — parent/children two-way consistency + detached roots.
+ // Pass 3: topology — parent/children two-way consistency. A prefab has ONE
+ // root, so a second entity with no parent is adrift rather than a sibling.
for (const e of prefab.entities) {
- if (e.parent === null) {
- if (e.prefabEntityId !== prefab.rootEntityId) {
- push('detached-entity', 'error', `entity "${e.prefabEntityId}" has parent=null but is not the root`, e.prefabEntityId);
- }
- } else {
- const parent = byId.get(e.parent);
- if (!parent) {
- push('missing-parent', 'error', `entity "${e.prefabEntityId}" parent "${e.parent}" does not exist`, e.prefabEntityId);
- } else if (!parent.children.includes(e.prefabEntityId)) {
- push('inconsistent-topology', 'error', `entity "${e.prefabEntityId}" claims parent "${e.parent}" but that parent's children omit it`, e.prefabEntityId);
- }
- }
- for (const childId of e.children) {
- const child = byId.get(childId);
- if (!child) {
- push('missing-child', 'error', `entity "${e.prefabEntityId}" lists child "${childId}" which does not exist`, e.prefabEntityId, childId);
- } else if (child.parent !== e.prefabEntityId) {
- push('inconsistent-topology', 'error', `entity "${e.prefabEntityId}" lists "${childId}" as a child but its parent points elsewhere`, e.prefabEntityId, childId);
- }
+ if (e.parent === null && e.prefabEntityId !== prefab.rootEntityId) {
+ push('detached-entity', 'error', `entity "${e.prefabEntityId}" has parent=null but is not the root`, e.prefabEntityId);
}
}
+ checkDocumentTopology(nodes, nodeById, push);
- // Pass 4: no parent cycle (report at most one — a cycle spams otherwise).
- detectParentCycle(prefab, byId, push);
+ // Pass 4: no parent cycle.
+ checkParentCycle(nodes, nodeById, push);
// Pass 5: every entity reachable from the root (via children edges).
if (byId.has(prefab.rootEntityId)) {
@@ -289,19 +264,10 @@ export function validatePrefab(
}
}
- // Pass 6: entity-ref component fields must resolve within the prefab.
- for (const e of prefab.entities) {
- for (const c of e.components) {
- const def = getComponent(c.type);
- if (!def || def.entityFields.length === 0) continue;
- for (const field of def.entityFields) {
- const v = c.data[field];
- if (typeof v === 'string' && !byId.has(v)) {
- push('dangling-entity-ref', 'warning', `entity "${e.prefabEntityId}" field "${c.type}.${field}" references "${v}", which is not in the prefab`, e.prefabEntityId, `${c.type}.${field}`);
- }
- }
- }
- }
+ // Pass 6: entity-ref component fields must resolve within the prefab. A
+ // prefab's ids are strings, so a numeric field is a runtime handle that never
+ // belonged to the document.
+ checkEntityRefs(nodes, nodeById, push, (v) => typeof v !== 'string');
// Pass 7: override shape + staleness (variant / instance / nested sites).
const checkOverrides = (
@@ -372,35 +338,6 @@ function overrideShapeError(o: PrefabOverride): string | null {
}
}
-function detectParentCycle(
- prefab: PrefabData,
- byId: Map<PrefabEntityId, PrefabEntityData>,
- push: (code: string, severity: PrefabDiagnosticSeverity, message: string, entityId?: PrefabEntityId) => void,
-): void {
- const WHITE = 0, GRAY = 1, BLACK = 2;
- const color = new Map<PrefabEntityId, number>();
- for (const e of prefab.entities) color.set(e.prefabEntityId, WHITE);
- let reported = false;
-
- const visit = (id: PrefabEntityId, path: PrefabEntityId[]): void => {
- if (reported) return;
- const c = color.get(id);
- if (c === BLACK) return;
- if (c === GRAY) {
- const start = path.indexOf(id);
- const cycle = path.slice(start).concat(id).join(' → ');
- push('parent-cycle', 'error', `parent cycle detected: ${cycle}`, id);
- reported = true;
- return;
- }
- color.set(id, GRAY);
- const e = byId.get(id);
- if (e && e.parent !== null && byId.has(e.parent)) visit(e.parent, [...path, id]);
- color.set(id, BLACK);
- };
- for (const e of prefab.entities) visit(e.prefabEntityId, []);
-}
-
function detectDependencyCycle(
prefab: PrefabData,
loadPrefab: (path: string) => PrefabData | null,
diff --git a/sdk/src/scene/scene.ts b/sdk/src/scene/scene.ts
index 88dcc8525..5f4d82933 100644
--- a/sdk/src/scene/scene.ts
+++ b/sdk/src/scene/scene.ts
@@ -7,6 +7,8 @@
import { World } from '../ecs/world';
import { Entity, INVALID_ENTITY } from '../types';
+import { isPrefabEntry, type SceneEntry } from './sceneEntry';
+import { validateScene } from './validateScene';
import { getComponent, Name, Camera, RuntimeOnly } from '../ecs/component';
import { deepClone } from '../util/deepClone';
import { discoverSceneAssets } from '../asset/discoverAssets';
@@ -211,18 +213,6 @@ export function registerSceneComponentCodec(type: string, codec: SceneComponentC
// Prefab instance entries (runtime play == ship)
// =============================================================================
-// A scene-file entity is either an ordinary entity record or a prefab-instance
-// entry — a minimal delta over a `.esprefab` asset (`{ prefab, overrides, added,
-// removed }`). The runtime expands each instance into ordinary entities via the
-// SAME `flattenPrefab` core the editor uses (`prefab/sceneInstance.ts`), so a
-// saved prefab scene loads identically in the editor and at runtime.
-type SceneEntry = SceneEntityData | PrefabInstanceEntry;
-
-/** True for a prefab-instance entry (carries a `prefab` asset ref). */
-function isPrefabEntry(e: SceneEntry): e is PrefabInstanceEntry {
- return typeof (e as PrefabInstanceEntry).prefab === 'string';
-}
-
/** True if any scene entry is a prefab instance (cheap gate before expansion). */
export function sceneHasPrefabEntries(scene: SceneData): boolean {
return (scene.entities as SceneEntry[]).some(isPrefabEntry);
@@ -401,7 +391,32 @@ function normalizeLegacyComponent(compData: SceneComponentData): boolean {
// Scene Loader
// =============================================================================
+/**
+ * Findings that make a scene mean something other than what it says, where
+ * loading is worse than refusing: a repeated id sends every reference to it to
+ * whichever entity came last, and a parent cycle has no hierarchy to build.
+ * Everything else still loads — a lost parent leaves an entity at the root.
+ */
+const UNLOADABLE_SCENE: ReadonlySet<string> = new Set(['duplicate-id', 'parent-cycle']);
+
+/** Refuse a scene the loader cannot honour; report the rest and carry on. */
+function checkLoadable(sceneData: SceneData): void {
+ const diags = validateScene(sceneData);
+ if (diags.length === 0) return;
+ const fatal = diags.filter((d) => UNLOADABLE_SCENE.has(d.code));
+ for (const d of diags) {
+ if (!fatal.includes(d)) log.warn('scene', `${d.code}: ${d.message}`);
+ }
+ if (fatal.length > 0) {
+ throw new Error(
+ `Scene "${sceneData.name}" cannot be loaded as written:\n`
+ + fatal.map((d) => ` ${d.code}: ${d.message}`).join('\n'),
+ );
+ }
+}
+
function spawnAndLoadEntities(world: World, sceneData: SceneData): Map<number, Entity> {
+ checkLoadable(sceneData);
const entityMap = new Map<number, Entity>();
for (const entityData of sceneData.entities) {
diff --git a/sdk/src/scene/sceneEntry.ts b/sdk/src/scene/sceneEntry.ts
new file mode 100644
index 000000000..cffbd1df4
--- /dev/null
+++ b/sdk/src/scene/sceneEntry.ts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file The two things a scene file's entity list can hold, and how to tell
+ * them apart. Its own module so the loader and the validator ask the same
+ * question rather than each spelling the test out.
+ */
+import type { PrefabInstanceEntry } from '../prefab/sceneInstance';
+import type { SceneEntityData } from './scene';
+
+/**
+ * A scene-file entity is either an ordinary entity record or a prefab-instance
+ * entry — a minimal delta over a `.esprefab` asset. The runtime expands each
+ * instance through the same `flattenPrefab` core the editor uses, so a saved
+ * prefab scene loads identically in both.
+ */
+export type SceneEntry = SceneEntityData | PrefabInstanceEntry;
+
+/** True for a prefab-instance entry (carries a `prefab` asset ref). */
+export function isPrefabEntry(e: SceneEntry): e is PrefabInstanceEntry {
+ return typeof (e as PrefabInstanceEntry).prefab === 'string';
+}
diff --git a/sdk/src/scene/validateScene.ts b/sdk/src/scene/validateScene.ts
new file mode 100644
index 000000000..4b8771ab0
--- /dev/null
+++ b/sdk/src/scene/validateScene.ts
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file Everything wrong with a scene, in the vocabulary prefabs already speak.
+ *
+ * A prefab has been validated at every gate it passes since it got a
+ * format; a scene — the document a game actually ships — was checked
+ * nowhere, and the loader answered a repeated id by keeping whichever
+ * entity came last. Both are entity documents, so both are read by the
+ * shared checks, and a scene only adds what is its own: it is a forest
+ * rather than one rooted tree, and its prefab-instance entries stand in
+ * for entities that are not expanded yet.
+ */
+import {
+ checkDocumentIds,
+ checkDocumentTopology,
+ checkParentCycle,
+ checkEntityRefs,
+ type DiagnosticSink,
+ type DocumentDiagnostic,
+ type DocumentNode,
+} from '../document/diagnostics';
+import { INVALID_ENTITY } from '../types';
+import type { SceneData, SceneEntityData } from './scene';
+import { isPrefabEntry } from './sceneEntry';
+
+/** A scene entity as the shared checks read it. */
+const sceneNode = (e: SceneEntityData): DocumentNode => ({
+ id: e.id,
+ parent: e.parent ?? null,
+ children: e.children ?? [],
+ components: e.components ?? [],
+});
+
+/**
+ * Validate a scene and return every problem found. Errors mean the scene cannot
+ * be loaded into a world that means what the file says; warnings are loadable.
+ * Pure + total — nothing here throws, and the caller decides what a finding
+ * costs.
+ */
+export function validateScene(scene: SceneData): DocumentDiagnostic[] {
+ const diags: DocumentDiagnostic[] = [];
+ const push: DiagnosticSink = (code, severity, message, entityId, field): void => {
+ diags.push({
+ code,
+ severity,
+ message,
+ ...(entityId !== undefined ? { entityId } : {}),
+ ...(field !== undefined ? { field } : {}),
+ });
+ };
+
+ if (!Array.isArray(scene?.entities)) {
+ push('malformed', 'error', 'scene has no "entities" array');
+ return diags;
+ }
+
+ const nodes = scene.entities.map(sceneNode);
+ const byId = checkDocumentIds(nodes, push);
+ checkDocumentTopology(nodes, byId, push);
+ checkParentCycle(nodes, byId, push);
+ // A scene's ids are numbers, and 0 is how an unset reference is written.
+ checkEntityRefs(nodes, byId, push, (v) => v === INVALID_ENTITY || typeof v !== 'number');
+
+ for (const e of scene.entities) {
+ if (isPrefabEntry(e) || !Array.isArray(e.components)) continue;
+ for (const c of e.components) {
+ if (typeof c?.type !== 'string' || c.type.length === 0) {
+ push('malformed-component', 'error', `entity ${e.id} has a component with no type`, e.id);
+ }
+ }
+ }
+
+ return diags;
+}
+
+/** The findings that make a scene unloadable as written. */
+export const sceneErrors = (diags: readonly DocumentDiagnostic[]): DocumentDiagnostic[] =>
+ diags.filter((d) => d.severity === 'error');
diff --git a/sdk/tests/scene-validate.test.ts b/sdk/tests/scene-validate.test.ts
new file mode 100644
index 000000000..ff20951e3
--- /dev/null
+++ b/sdk/tests/scene-validate.test.ts
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * A scene is validated by the same pass a prefab is, and the loader refuses what
+ * it cannot honour. Each test pins one code, so they stay stable for readers.
+ */
+import { describe, it, expect } from 'vitest';
+import type { SceneData, DocumentDiagnostic } from '../src/index';
+import { validateScene, SCENE_FORMAT_VERSION, loadSceneData } from '../src/index';
+import { World } from '../src/ecs/world';
+import { defineComponent } from '../src/ecs/component';
+
+function clean(): SceneData {
+ return {
+ version: SCENE_FORMAT_VERSION,
+ name: 'Main',
+ entities: [
+ { id: 1, name: 'Player', parent: null, children: [2], components: [{ type: 'Transform', data: {} }] },
+ { id: 2, name: 'Sword', parent: 1, children: [], components: [] },
+ ],
+ };
+}
+
+const codes = (d: DocumentDiagnostic[]): string[] => d.map((x) => x.code);
+
+describe('validateScene', () => {
+ it('returns no diagnostics for a well-formed scene', () => {
+ expect(validateScene(clean())).toEqual([]);
+ });
+
+ it('flags a duplicate id', () => {
+ const s = clean();
+ s.entities.push({ id: 1, name: 'Impostor', parent: null, children: [], components: [] });
+ expect(codes(validateScene(s))).toContain('duplicate-id');
+ });
+
+ it('flags an entity carrying the same component twice', () => {
+ const s = clean();
+ s.entities[0].components.push({ type: 'Transform', data: {} });
+ expect(codes(validateScene(s))).toContain('duplicate-component');
+ });
+
+ it('flags a parent that does not exist', () => {
+ const s = clean();
+ s.entities[1].parent = 99;
+ expect(codes(validateScene(s))).toContain('missing-parent');
+ });
+
+ it('flags parent and children disagreeing', () => {
+ const s = clean();
+ s.entities[0].children = [];
+ expect(codes(validateScene(s))).toContain('inconsistent-topology');
+ });
+
+ it('flags a parent cycle', () => {
+ const s = clean();
+ s.entities[0].parent = 2;
+ s.entities[1].children = [1];
+ expect(codes(validateScene(s))).toContain('parent-cycle');
+ });
+
+ it('accepts a forest — a scene has no single root', () => {
+ const s = clean();
+ s.entities.push({ id: 3, name: 'Camera', parent: null, children: [], components: [] });
+ expect(validateScene(s)).toEqual([]);
+ });
+
+ it('warns, not errors, on a reference to an entity that is gone', () => {
+ defineComponent('Follower', { target: 0 }, { entityFields: ['target'] });
+ const s = clean();
+ s.entities[1].components.push({ type: 'Follower', data: { target: 42 } });
+ const found = validateScene(s).filter((d) => d.code === 'dangling-entity-ref');
+ expect(found).toHaveLength(1);
+ expect(found[0].severity).toBe('warning');
+ });
+
+ it('reads 0 as "no reference" rather than a dangling one', () => {
+ defineComponent('Watcher', { target: 0 }, { entityFields: ['target'] });
+ const s = clean();
+ s.entities[1].components.push({ type: 'Watcher', data: { target: 0 } });
+ expect(validateScene(s)).toEqual([]);
+ });
+});
+
+describe('loadSceneData refuses what it cannot honour', () => {
+ it('refuses a duplicate id rather than keeping whichever came last', () => {
+ const world = new World();
+ const s = clean();
+ s.entities.push({ id: 1, name: 'Impostor', parent: null, children: [], components: [] });
+ expect(() => loadSceneData(world, s)).toThrow(/duplicate-id/);
+ });
+
+ it('refuses a parent cycle', () => {
+ const world = new World();
+ const s = clean();
+ s.entities[0].parent = 2;
+ s.entities[1].children = [1];
+ expect(() => loadSceneData(world, s)).toThrow(/parent-cycle/);
+ });
+
+ it('loads a scene whose findings are only warnings', () => {
+ defineComponent('Chaser', { target: 0 }, { entityFields: ['target'] });
+ const world = new World();
+ const s = clean();
+ s.entities[1].components.push({ type: 'Chaser', data: { target: 77 } });
+ expect(loadSceneData(world, s).size).toBe(2);
+ });
+});
diff --git a/tools/gates.mjs b/tools/gates.mjs
index 026453053..325fa3637 100644
--- a/tools/gates.mjs
+++ b/tools/gates.mjs
@@ -93,7 +93,7 @@ export const GATES = [
// on, and refuses a published verdict the tags do not carry.
{ id: 'subsystem-tiers', run: 'node tools/check-subsystem-tiers.mjs' },
{ id: 'examples', run: 'node build-tools/cli.js check-examples' },
- { id: 'prefabs', run: 'node build-tools/cli.js validate-prefabs' },
+ { id: 'documents', run: 'node build-tools/cli.js validate-documents' },
];
/** The gates a scope runs, in declaration order. */