@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / ScriptComponent
Class: ScriptComponent ​
Defined in: components/ScriptComponent.ts:35
Component holding the list of scripts attached to an entity. Loaded from the saved project; the runtime-side fields (scriptInstance, scriptInstances) are non-enumerable so they never leak into save data or undo history.
Remarks ​
Authored scripts subclass Behaviour.
Extends ​
Constructors ​
Constructor ​
ts
new ScriptComponent(entries?): ScriptComponent;Defined in: components/ScriptComponent.ts:43
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
entries | ScriptEntry[] | [] |
Returns ​
ScriptComponent
Overrides ​
Properties ​
| Property | Type | Description | Defined in |
|---|---|---|---|
entries | ScriptEntry[] | Authored script entries attached to the entity. Each entry references a class by name plus its inspector field overrides. Saved with the project. | components/ScriptComponent.ts:37 |
scriptInstance | unknown | First live behaviour instance after compile/load. Non-enumerable, so it does not appear in save data. null when no script is loaded. | components/ScriptComponent.ts:39 |
scriptInstances | Map<number, unknown> | Map of entityId to its compiled behaviour instance (one entry per script bound to the entity). Non-enumerable, so it does not appear in save data. | components/ScriptComponent.ts:41 |

