Script Object
An entity whose visual is built by a user ScriptObject script (custom shaders, procedural geometry, particles). Renders and animates in the editor AND at runtime. Starts as an empty THREE.Group; ScriptObjectSystem builds the visual once a script is linked.
ts
import { Behaviour } from "@relu-interactives/spatial-ecs";
export default class Spawner extends Behaviour {
init() {
const objects = this.world.getObjectManagementSystem();
objects?.requestCreate("scriptObject", {
name: "Wave",
transform: { position: { x: 0, y: 0, z: -3 } },
options: {
scriptUrl: "localasset://.../scripts/WavePlane.js",
className: "WavePlane",
},
});
}
}Payload
| Field | Type | Default | Description |
|---|---|---|---|
name | string | "Script Object" | Display name. |
transform | TransformData | identity | Position / rotation (radians) / scale. |
options.scriptUrl | string | null | null | Compiled script URL. Optional — can be assigned later in the inspector. |
options.className | string | null | null | Exported ScriptObject class name. |
options.enabled | boolean | true | When false, the visual isn't built/ticked. |
options.data | Record<string, unknown> | {} | Initial inspector data. |
Components attached
Transform, Object3DRef, Name, EntityType, ParentId, Selectable, ScriptObjectComponent.

