Name | Description |
_enterTree
|
Called when the node enters the SceneTree (e.g. upon instancing, scene changing, or after calling addChild in a script). If the node has children, its enterTree callback will be called first, and then that of the children.
Corresponds to the constant NOTIFICATION_ENTER_TREE notification in GodotObject.notification .
|
_exitTree
|
Called when the node is about to leave the SceneTree (e.g. upon freeing, scene changing, or after calling removeChild in a script). If the node has children, its exitTree callback will be called last, after all its children have left the tree.
Corresponds to the constant NOTIFICATION_EXIT_TREE notification in GodotObject.notification and signal treeExiting . To get notified when the node has already left the active tree, connect to the treeExited .
|
_getConfigurationWarning
|
The string returned from this method is displayed as a warning in the Scene Dock if the script that overrides it is a tool script.
Returning an empty string produces no warning.
Call updateConfigurationWarning when the warning needs to be updated for this node.
|
_getEditorDescription
|
|
_getImportPath
|
|
_input
|
Called when there is an input event. The input event propagates up through the node tree until a node consumes it.
It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with setProcessInput .
To consume the input event and stop it propagating further to other nodes, SceneTree.setInputAsHandled can be called.
For gameplay input, unhandledInput and unhandledKeyInput are usually a better fit as they allow the GUI to intercept the events first.
|
_physicsProcess
|
Called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the delta variable should be constant.
It is only called if physics processing is enabled, which is done automatically if this method is overridden, and can be toggled with setPhysicsProcess .
Corresponds to the constant NOTIFICATION_PHYSICS_PROCESS notification in GodotObject.notification .
|
_process
|
Called during the processing step of the main loop. Processing happens at every frame and as fast as possible, so the delta time since the previous frame is not constant.
It is only called if processing is enabled, which is done automatically if this method is overridden, and can be toggled with setProcess .
Corresponds to the constant NOTIFICATION_PROCESS notification in GodotObject.notification .
|
_ready
|
Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their ready callbacks get triggered first, and the parent node will receive the ready notification afterwards.
Corresponds to the constant NOTIFICATION_READY notification in GodotObject.notification . See also the onready keyword for variables.
Usually used for initialization. For even earlier initialization, GodotObject.init may be used. See also enterTree .
Note: ready may be called only once for each node. After removing a node from the scene tree and adding again, _ready will not be called for the second time. This can be bypassed with requesting another call with requestReady , which may be called anywhere before adding the node again.
|
_setEditorDescription
|
|
_setImportPath
|
|
_unhandledInput
|
Called when an InputEvent hasn't been consumed by input or any GUI. The input event propagates up through the node tree until a node consumes it.
It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with setProcessUnhandledInput .
To consume the input event and stop it propagating further to other nodes, SceneTree.setInputAsHandled can be called.
For gameplay input, this and unhandledKeyInput are usually a better fit than input as they allow the GUI to intercept the events first.
|
_unhandledKeyInput
|
Called when an InputEventKey hasn't been consumed by input or any GUI. The input event propagates up through the node tree until a node consumes it.
It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with setProcessUnhandledKeyInput .
To consume the input event and stop it propagating further to other nodes, SceneTree.setInputAsHandled can be called.
For gameplay input, this and unhandledInput are usually a better fit than input as they allow the GUI to intercept the events first.
|
addChild
|
Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.
If legible_unique_name is true , the child node will have an human-readable name based on the name of the node being instanced instead of its type.
Note: If the child node already has a parent, the function will fail. Use removeChild first to remove the node from its current parent. For example:
|
addChildBelowNode
|
Adds a child node. The child is placed below the given node in the list of children.
If legible_unique_name is true , the child node will have an human-readable name based on the name of the node being instanced instead of its type.
|
addToGroup
|
Adds the node to a group. Groups are helpers to name and organize a subset of nodes, for example "enemies" or "collectables". A node can be in any number of groups. Nodes can be assigned a group at any time, but will not be added until they are inside the scene tree (see isInsideTree ). See notes in the description, and the group methods in SceneTree .
The persistent option is used when packing node to PackedScene and saving to file. Non-persistent groups aren't stored.
|
canProcess
|
Returns true if the node can process while the scene tree is paused (see pauseMode ). Always returns true if the scene tree is not paused, and false if the node is not in the tree.
|
duplicate
|
Duplicates the node, returning a new node.
You can fine-tune the behavior using the flags (see duplicateflags ).
Note: It will not work properly if the node contains a script with constructor arguments (i.e. needs to supply arguments to GodotObject.init method). In that case, the node will be duplicated without a script.
|
findNode
|
Finds a descendant of this node whose name matches mask as in String.match (i.e. case-sensitive, but "*" matches zero or more characters and "?" matches any single character except "." ).
Note: It does not match against the full path, just against individual node names.
If owned is true , this method only finds nodes whose owner is this node. This is especially important for scenes instantiated through a script, because those scenes don't have an owner.
|
findParent
|
Finds the first parent of the current node whose name matches mask as in String.match (i.e. case-sensitive, but "*" matches zero or more characters and "?" matches any single character except "." ).
Note: It does not match against the full path, just against individual node names.
|
getChild
|
Returns a child node by its index (see getChildCount ). This method is often used for iterating all children of a node.
To access a child node via its name, use getNode .
|
getChildCount
|
Returns the number of child nodes.
|
getChildren
|
Returns an array of references to node's children.
|
getCustomMultiplayer
|
|
getFilename
|
|
getGroups
|
Returns an array listing the groups that the node is a member of.
|
getIndex
|
Returns the node's index, i.e. its position among the siblings of its parent.
|
getMultiplayer
|
|
getName
|
|
getNetworkMaster
|
Returns the peer ID of the network master for this node. See setNetworkMaster .
|
getNode
|
Fetches a node. The NodePath can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, a null instance is returned and an error is logged. Attempts to access methods on the return value will result in an "Attempt to call <method> on a null instance." error.
Note: Fetching absolute paths only works when the node is inside the scene tree (see isInsideTree ).
Example: Assume your current node is Character and the following tree:
|
getNodeAndResource
|
Fetches a node and one of its resources as specified by the NodePath 's subname (e.g. Area2D/CollisionShape2D:shape ). If several nested resources are specified in the NodePath , the last one will be fetched.
The return value is an array of size 3: the first index points to the Node (or null if not found), the second index points to the Resource (or null if not found), and the third index is the remaining NodePath , if any.
For example, assuming that Area2D/CollisionShape2D is a valid node and that its shape property has been assigned a RectangleShape2D resource, one could have this kind of output:
|
getNodeOrNull
|
Similar to getNode , but does not log an error if path does not point to a valid Node .
|
getOwner
|
|
getParent
|
Returns the parent node of the current node, or an empty Node if the node lacks a parent.
|
getPath
|
Returns the absolute path of the current node. This only works if the current node is inside the scene tree (see isInsideTree ).
|
getPathTo
|
Returns the relative NodePath from this node to the specified node . Both nodes must be in the same scene or the function will fail.
|
getPauseMode
|
|
getPhysicsProcessDeltaTime
|
Returns the time elapsed since the last physics-bound frame (see physicsProcess ). This is always a constant value in physics processing unless the frames per second is changed via Engine.targetFps .
|
getPositionInParent
|
Returns the node's order in the scene tree branch. For example, if called on the first child node the position is 0 .
|
getProcessDeltaTime
|
Returns the time elapsed (in seconds) since the last process callback. This value may vary from frame to frame.
|
getProcessPriority
|
|
getSceneInstanceLoadPlaceholder
|
Returns true if this is an instance load placeholder. See InstancePlaceholder .
|
getTree
|
Returns the SceneTree that contains this node.
|
getViewport
|
Returns the node's Viewport .
|
hasNode
|
Returns true if the node that the NodePath points to exists.
|
hasNodeAndResource
|
Returns true if the NodePath points to a valid node and its subname points to a valid resource, e.g. Area2D/CollisionShape2D:shape . Properties with a non-Resource type (e.g. nodes or primitive math types) are not considered resources.
|
isAParentOf
|
Returns true if the given node is a direct or indirect child of the current node.
|
isDisplayedFolded
|
Returns true if the node is folded (collapsed) in the Scene dock.
|
isGreaterThan
|
Returns true if the given node occurs later in the scene hierarchy than the current node.
|
isInGroup
|
Returns true if this node is in the specified group. See notes in the description, and the group methods in SceneTree .
|
isInsideTree
|
Returns true if this node is currently inside a SceneTree .
|
isNetworkMaster
|
Returns true if the local system is the master of this node.
|
isPhysicsProcessing
|
Returns true if physics processing is enabled (see setPhysicsProcess ).
|
isPhysicsProcessingInternal
|
Returns true if internal physics processing is enabled (see setPhysicsProcessInternal ).
|
isProcessing
|
Returns true if processing is enabled (see setProcess ).
|
isProcessingInput
|
Returns true if the node is processing input (see setProcessInput ).
|
isProcessingInternal
|
Returns true if internal processing is enabled (see setProcessInternal ).
|
isProcessingUnhandledInput
|
Returns true if the node is processing unhandled input (see setProcessUnhandledInput ).
|
isProcessingUnhandledKeyInput
|
Returns true if the node is processing unhandled key input (see setProcessUnhandledKeyInput ).
|
moveChild
|
Moves a child node to a different position (order) among the other children. Since calls, signals, etc are performed by tree order, changing the order of children nodes may be useful.
|
printStrayNodes
|
Prints all stray nodes (nodes outside the SceneTree ). Used for debugging. Works only in debug builds.
|
printTree
|
Prints the tree to stdout. Used mainly for debugging purposes. This version displays the path relative to the current node, and is good for copy/pasting into the getNode function.
Example output:
|
printTreePretty
|
Similar to printTree , this prints the tree to stdout. This version displays a more graphical representation similar to what is displayed in the scene inspector. It is useful for inspecting larger trees.
Example output:
|
propagateCall
|
Calls the given method (if present) with the arguments given in args on this node and recursively on all its children. If the parent_first argument is true , the method will be called on the current node first, then on all its children. If parent_first is false , the children will be called first.
|
propagateNotification
|
Notifies the current node and all its children recursively by calling GodotObject.notification on all of them.
|
queueFree
|
Queues a node for deletion at the end of the current frame. When deleted, all of its child nodes will be deleted as well. This method ensures it's safe to delete the node, contrary to GodotObject.free . Use GodotObject.isQueuedForDeletion to check whether a node will be deleted at the end of the frame.
|
raise
|
Moves this node to the bottom of parent node's children hierarchy. This is often useful in GUIs (Control nodes), because their order of drawing depends on their order in the tree, i.e. the further they are on the node list, the higher they are drawn. After using raise , a Control will be drawn on top of their siblings.
|
removeAndSkip
|
Removes a node and sets all its children as children of the parent node (if it exists). All event subscriptions that pass by the removed node will be unsubscribed.
|
removeChild
|
Removes a child node. The node is NOT deleted and must be deleted manually.
|
removeFromGroup
|
Removes a node from a group. See notes in the description, and the group methods in SceneTree .
|
replaceBy
|
Replaces a node in a scene by the given one. Subscriptions that pass through this node will be lost.
|
requestReady
|
Requests that _ready be called again. Note that the method won't be called immediately, but is scheduled for when the node is added to the scene tree again (see ready ). _ready is called only for the node which requested it, which means that you need to request ready for each child if you want them to call _ready too (in which case, _ready will be called in the same order as it would normally).
|
rpc
|
Sends a remote procedure call request for the given method to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same NodePath , including the exact same node name. Behaviour depends on the RPC configuration for the given method, see rpcConfig . Methods are not exposed to RPCs by default. See also rset and rsetConfig for properties. Returns an empty Variant .
Note: You can only safely use RPCs on clients after you received the connected_to_server signal from the SceneTree . You also need to keep track of the connection state, either by the SceneTree signals like server_disconnected or by checking SceneTree.network_peer.get_connection_status() == CONNECTION_CONNECTED .
|
rpcConfig
|
Changes the RPC mode for the given method to the given mode . See MultiplayerAPI.rpcmode . An alternative is annotating methods and properties with the corresponding keywords (remote , master , puppet , remotesync , mastersync , puppetsync ). By default, methods are not exposed to networking (and RPCs). See also rset and rsetConfig for properties.
|
rpcId
|
Sends a rpc to a specific peer identified by peer_id (see NetworkedMultiplayerPeer.setTargetPeer ). Returns an empty Variant .
|
rpcUnreliable
|
Sends a rpc using an unreliable protocol. Returns an empty Variant .
|
rpcUnreliableId
|
Sends a rpc to a specific peer identified by peer_id using an unreliable protocol (see NetworkedMultiplayerPeer.setTargetPeer ). Returns an empty Variant .
|
rset
|
Remotely changes a property's value on other peers (and locally). Behaviour depends on the RPC configuration for the given property, see rsetConfig . See also rpc for RPCs for methods, most information applies to this method as well.
|
rsetConfig
|
Changes the RPC mode for the given property to the given mode . See MultiplayerAPI.rpcmode . An alternative is annotating methods and properties with the corresponding keywords (remote , master , puppet , remotesync , mastersync , puppetsync ). By default, properties are not exposed to networking (and RPCs). See also rpc and rpcConfig for methods.
|
rsetId
|
Remotely changes the property's value on a specific peer identified by peer_id (see NetworkedMultiplayerPeer.setTargetPeer ).
|
rsetUnreliable
|
Remotely changes the property's value on other peers (and locally) using an unreliable protocol.
|
rsetUnreliableId
|
Remotely changes property's value on a specific peer identified by peer_id using an unreliable protocol (see NetworkedMultiplayerPeer.setTargetPeer ).
|
setCustomMultiplayer
|
|
setDisplayFolded
|
Sets the folded state of the node in the Scene dock.
|
setFilename
|
|
setName
|
|
setNetworkMaster
|
Sets the node's network master to the peer with the given peer ID. The network master is the peer that has authority over the node on the network. Useful in conjunction with the master and puppet keywords. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server). If recursive , the given peer is recursively set as the master for all children of this node.
|
setOwner
|
|
setPauseMode
|
|
setPhysicsProcess
|
Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a constant NOTIFICATION_PHYSICS_PROCESS at a fixed (usually 60 FPS, see Engine.targetFps to change) interval (and the physicsProcess callback will be called if exists). Enabled automatically if physicsProcess is overridden. Any calls to this before ready will be ignored.
|
setPhysicsProcessInternal
|
Enables or disables internal physics for this node. Internal physics processing happens in isolation from the normal physicsProcess calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting (setPhysicsProcess ). Only useful for advanced uses to manipulate built-in nodes' behaviour.
|
setProcess
|
Enables or disables processing. When a node is being processed, it will receive a constant NOTIFICATION_PROCESS on every drawn frame (and the process callback will be called if exists). Enabled automatically if process is overridden. Any calls to this before ready will be ignored.
|
setProcessInput
|
Enables or disables input processing. This is not required for GUI controls! Enabled automatically if input is overridden. Any calls to this before ready will be ignored.
|
setProcessInternal
|
Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal process calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting (setProcess ). Only useful for advanced uses to manipulate built-in nodes' behaviour.
|
setProcessPriority
|
|
setProcessUnhandledInput
|
Enables unhandled input processing. This is not required for GUI controls! It enables the node to receive all input that was not previously handled (usually by a Control ). Enabled automatically if unhandledInput is overridden. Any calls to this before ready will be ignored.
|
setProcessUnhandledKeyInput
|
Enables unhandled key input processing. Enabled automatically if unhandledKeyInput is overridden. Any calls to this before ready will be ignored.
|
setSceneInstanceLoadPlaceholder
|
Sets whether this is an instance load placeholder. See InstancePlaceholder .
|
updateConfigurationWarning
|
Updates the warning displayed for this node in the Scene Dock.
Use getConfigurationWarning to setup the warning message to display.
|