Skip to content

@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 ​

ParameterTypeDefault value
entriesScriptEntry[][]

Returns ​

ScriptComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDescriptionDefined in
entriesScriptEntry[]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
scriptInstanceunknownFirst 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
scriptInstancesMap<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