Constructor
This extended node inherits from EventEmitter.
EntityNode()
Instantiates an extended node class.
Components can only be attached to extended nodes.
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
entity | Yes | T | A game entity, which can be any entity such as a character, item, UI element, etc. |
Return Value
Type | Description |
---|---|
EntityNode | The extended node class |
Static Properties
isMonitoringEnabled
Sets whether to enable global performance monitoring. Defaults to true
.
When enabled, the Component.update
method of all components will be tracked by the performance monitor to record and analyze their execution performance. Disabling this option can reduce performance overhead and is suitable for production environments or scenarios where performance monitoring is not required.
Properties
uuid
Gets the UUID of this node.
components
Gets all component instances on this node.
entity
Gets the associated game entity.
enable
The enabled state of the node, which affects the per-frame update and the enabled state of components on the node.
Static Methods
onPerformanceWarning()
Sets the global performance warning callback for components.
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
event | Yes | (event: IonPerformanceData) => void | The callback method |
Methods
addComponent()
Adds a component of the specified type to this node.
[Using component constructor]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentConstructor | Yes | new (...args: any[]) => U | The component constructor | |
object | No | {} | Partial‹Omit‹U, keyof Component‹T››› | Initial properties for the component, does not modify properties by default |
addComponent()
Adds a component of the specified type to this node.
The child component class must have the @apclass
decorator. Otherwise, the component instance cannot be obtained.
[Using component name]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentName | Yes | string | The component name | |
object | No | {} | Record<string, any> | Initial properties for the component, does not modify properties by default |
getComponent()
Gets a component of the specified type on this node.
[Using component name]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentName | Yes | string | The component name |
getComponent()
Gets a component of the specified type on this node.
[Using component constructor]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentConstructor | Yes | new (...args: any[]) => U | The component constructor |
getComponentPerformance()
Gets the performance data for a specified component on this node.
[Using component name]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentName | Yes | string | The component name |
getComponentPerformance()
Gets the performance data for a specified component on this node.
[Using component constructor]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentConstructor | Yes | new (...args: any[]) => U | The component constructor |
getComponents()
Gets all components on this node.
removeComponent()
Removes a component of the specified type from the node.
[Using component name]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentName | Yes | string | The component name |
removeComponent()
Removes a component of the specified type from the node.
[Using component constructor]
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
componentConstructor | Yes | new (...args: any[]) => U | The component constructor |
removeComponentAll()
Removes all components from the node.
destroy()
Removes the node and all its components, and cleans up related resources.
Functions
find()
Gets a registered node instance from the global registry by entity or UUID.
- Priority: entity > uuid
Input Parameters
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
entityOrUUID | Yes | U | The game entity or node UUID |