Skip to content

Component

Description

Let's you attach persistent data to nodes. The ComponentsApi will call a components constructor with the node as parameter for component creation should no create method exist.

Methods

void component_node_removed ( Node node )
Component static create ( Node node )
Component static deserialize ( Node node, Variant data )
void detached ( Node node )
Variant serialize ( Node node )

Method Descriptions

static Component create ( Node node ):
Optional method offering more fine control over component creation than just having a constructor.

Variant serialize ( Node node ):
Implement to return serialized Component data.

static Component deserialize ( Node node, Variant data ):
Implement to deserialize a Component on node from data

void detached ( Node node ):
Optional method that is called just before the component is detached from node.

void component_node_removed ( Node node ):
Optional method that is called when node (the node this Component is attached to) is removed from the scene tree