Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / ScriptEntry

Type Alias: ScriptEntry

ts
type ScriptEntry = {
  entityId: number;
  className: string;
  scriptUrl: string;
  enabled: boolean;
  executeInEditor?: boolean;
  data: Record<string, unknown>;
  runtimeState?: "idle" | "loading" | "ready" | "error";
  runtimeMessage?: string;
};

Defined in: components/ScriptComponent.ts:7

One script attached to an entity. Multiple entries may target a single entity (different classes from the same or different files).

Properties

PropertyTypeDescriptionDefined in
entityIdnumberOwning entity id.components/ScriptComponent.ts:9
classNamestringClass name exported by the script module (default export class name).components/ScriptComponent.ts:11
scriptUrlstringCompiled script URL (e.g. localasset://.../scripts/foo.js).components/ScriptComponent.ts:13
enabledbooleanWhen false, the script is skipped each frame.components/ScriptComponent.ts:15
executeInEditor?booleanWhen true, the script is executed inside the editor (not just at preview/runtime). Enables direct Three.js scene access via this.world.getScene() / getCamera() / getRenderer() for logic the editor's object palette cannot produce (custom shaders, procedural geometry, grass, etc.). Defaults to false.components/ScriptComponent.ts:22
dataRecord<string, unknown>Inspector-bound payload exposed to the script as this.data.components/ScriptComponent.ts:24
runtimeState?"idle" | "loading" | "ready" | "error"Last load/runtime status reported by ScriptBehaviourSystem.components/ScriptComponent.ts:26
runtimeMessage?stringOptional human-readable status message (e.g. compile/load error).components/ScriptComponent.ts:28