Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins. See also godot.EditorScript to add functions to the editor.

Constructor

@:native("new")new()

Variables

read onlyonMainScreenChanged:Signal<(screenName:String) ‑> Void>

main_screen_changed signal.

read onlyonResourceSaved:Signal<(resource:Resource) ‑> Void>

resource_saved signal.

read onlyonSceneChanged:Signal<(sceneRoot:Node) ‑> Void>

scene_changed signal.

read onlyonSceneClosed:Signal<(filepath:String) ‑> Void>

scene_closed signal.

Methods

@:native("AddAutoloadSingleton")addAutoloadSingleton(name:String, path:String):Void

Adds a script at path to the Autoload list as name.

@:native("AddControlToBottomPanel")addControlToBottomPanel(control:Control, title:String):ToolButton

Adds a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with godot.EditorPlugin.removeControlFromBottomPanel and free it with godot.Node.queueFree.

@:native("AddControlToContainer")addControlToContainer(container:EditorPlugin_CustomControlContainer, control:Control):Void

Adds a custom control to a container (see godot.EditorPlugin_CustomControlContainer). There are many locations where custom controls can be added in the editor UI.

Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).

When your plugin is deactivated, make sure to remove your custom control with godot.EditorPlugin.removeControlFromContainer and free it with godot.Node.queueFree.

@:native("AddControlToDock")addControlToDock(slot:EditorPlugin_DockSlot, control:Control):Void

Adds the control to a specific dock slot (see godot.EditorPlugin_DockSlot for options).

If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.

When your plugin is deactivated, make sure to remove your custom control with godot.EditorPlugin.removeControlFromDocks and free it with godot.Node.queueFree.

@:native("AddCustomType")addCustomType(type:String, base:String, script:Script, icon:Texture):Void

Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.

When given node or resource is selected, the base type will be instanced (ie, "Spatial", "Control", "Resource"), then the script will be loaded and set to this object.

You can use the virtual method godot.EditorPlugin.handles to check if your custom object is being edited by checking the script or using the is keyword.

During run-time, this will be a simple object with a script so this function does not need to be called then.

@:native("AddExportPlugin")addExportPlugin(plugin:EditorExportPlugin):Void

Registers a new godot.EditorExportPlugin. Export plugins are used to perform tasks when the project is being exported.

See godot.EditorPlugin.addInspectorPlugin for an example of how to register a plugin.

@:native("AddImportPlugin")addImportPlugin(importer:EditorImportPlugin):Void

Registers a new godot.EditorImportPlugin. Import plugins are used to import custom and unsupported assets as a custom godot.Resource type.

Note: If you want to import custom 3D asset formats use godot.EditorPlugin.addSceneImportPlugin instead.

See godot.EditorPlugin.addInspectorPlugin for an example of how to register a plugin.

@:native("AddInspectorPlugin")addInspectorPlugin(plugin:EditorInspectorPlugin):Void

Registers a new godot.EditorInspectorPlugin. Inspector plugins are used to extend godot.EditorInspector and provide custom configuration tools for your object's properties.

Note: Always use godot.EditorPlugin.removeInspectorPlugin to remove the registered godot.EditorInspectorPlugin when your godot.EditorPlugin is disabled to prevent leaks and an unexpected behavior.


const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd")
var inspector_plugin = MyInspectorPlugin.new()

func _enter_tree():
add_inspector_plugin(inspector_plugin)

func _exit_tree():
remove_inspector_plugin(inspector_plugin)

@:native("AddSceneImportPlugin")addSceneImportPlugin(sceneImporter:EditorSceneImporter):Void

Registers a new godot.EditorSceneImporter. Scene importers are used to import custom 3D asset formats as scenes.

@:native("AddSpatialGizmoPlugin")addSpatialGizmoPlugin(plugin:EditorSpatialGizmoPlugin):Void

Registers a new godot.EditorSpatialGizmoPlugin. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a godot.Spatial.

See godot.EditorPlugin.addInspectorPlugin for an example of how to register a plugin.

@:native("AddToolMenuItem")addToolMenuItem(name:String, handler:Object, callback:String, ?ud:Dynamic):Void

Adds a custom menu item to Project > Tools as name that calls callback on an instance of handler with a parameter ud when user activates it.

@:native("AddToolSubmenuItem")addToolSubmenuItem(name:String, submenu:Object):Void

Adds a custom submenu under Project > Tools > name. submenu should be an object of class godot.PopupMenu. This submenu should be cleaned up using remove_tool_menu_item(name).

@:native("ApplyChanges")applyChanges():Void

This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency.

This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object.

@:native("Build")build():Bool

This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs.

This method must return a boolean. If this method returns false, the project will not run. The run is aborted immediately, so this also prevents all other plugins' godot.EditorPlugin.build methods from running.

@:native("Clear")clear():Void

Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene.

@:native("DisablePlugin")disablePlugin():Void

Called by the engine when the user disables the godot.EditorPlugin in the Plugin tab of the project settings window.

@:native("Edit")edit(object:Object):Void

This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.

@:native("EnablePlugin")enablePlugin():Void

Called by the engine when the user enables the godot.EditorPlugin in the Plugin tab of the project settings window.

@:native("ForwardCanvasDrawOverViewport")forwardCanvasDrawOverViewport(overlay:Control):Void

Called by the engine when the 2D editor's viewport is updated. Use the overlay godot.Control for drawing. You can update the viewport manually by calling godot.EditorPlugin.updateOverlays.


func forward_canvas_draw_over_viewport(overlay):
# Draw a circle at cursor position.
overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.white)

func forward_canvas_gui_input(event):
if event is InputEventMouseMotion:
# Redraw viewport when cursor is moved.
update_overlays()
return true
return false

@:native("ForwardCanvasForceDrawOverViewport")forwardCanvasForceDrawOverViewport(overlay:Control):Void

This method is the same as godot.EditorPlugin.forwardCanvasDrawOverViewport, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.

You need to enable calling of this method by using godot.EditorPlugin.setForceDrawOverForwardingEnabled.

@:native("ForwardCanvasGuiInput")forwardCanvasGuiInput(event:InputEvent):Bool

Called when there is a root node in the current edited scene, godot.EditorPlugin.handles is implemented and an godot.InputEvent happens in the 2D viewport. Intercepts the godot.InputEvent, if return true godot.EditorPlugin consumes the event, otherwise forwards event to other Editor classes. Example:


# Prevents the InputEvent to reach other Editor classes
func forward_canvas_gui_input(event):
var forward = true
return forward

Must return false in order to forward the godot.InputEvent to other Editor classes. Example:


# Consumes InputEventMouseMotion and forwards other InputEvent types
func forward_canvas_gui_input(event):
var forward = false
if event is InputEventMouseMotion:
forward = true
return forward

@:native("ForwardSpatialDrawOverViewport")forwardSpatialDrawOverViewport(overlay:Control):Void

Called by the engine when the 3D editor's viewport is updated. Use the overlay godot.Control for drawing. You can update the viewport manually by calling godot.EditorPlugin.updateOverlays.


func forward_spatial_draw_over_viewport(overlay):
# Draw a circle at cursor position.
overlay.draw_circle(overlay.get_local_mouse_position(), 64)

func forward_spatial_gui_input(camera, event):
if event is InputEventMouseMotion:
# Redraw viewport when cursor is moved.
update_overlays()
return true
return false

@:native("ForwardSpatialForceDrawOverViewport")forwardSpatialForceDrawOverViewport(overlay:Control):Void

This method is the same as godot.EditorPlugin.forwardSpatialDrawOverViewport, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.

You need to enable calling of this method by using godot.EditorPlugin.setForceDrawOverForwardingEnabled.

@:native("ForwardSpatialGuiInput")forwardSpatialGuiInput(camera:Camera, event:InputEvent):Bool

Called when there is a root node in the current edited scene, godot.EditorPlugin.handles is implemented and an godot.InputEvent happens in the 3D viewport. Intercepts the godot.InputEvent, if return true godot.EditorPlugin consumes the event, otherwise forwards event to other Editor classes. Example:


# Prevents the InputEvent to reach other Editor classes
func forward_spatial_gui_input(camera, event):
var forward = true
return forward

Must return false in order to forward the godot.InputEvent to other Editor classes. Example:


# Consumes InputEventMouseMotion and forwards other InputEvent types
func forward_spatial_gui_input(camera, event):
var forward = false
if event is InputEventMouseMotion:
forward = true
return forward

inlinegetBreakpoints():Array<String>

This is for editors that edit script-based objects. You can return a list of breakpoints in the format (script:line), for example: res://path_to_script.gd:25.

@:native("GetEditorInterface")getEditorInterface():EditorInterface

Returns the godot.EditorInterface object that gives you control over Godot editor's window and its functionalities.

@:native("GetPluginIcon")getPluginIcon():Texture

Override this method in your plugin to return a godot.Texture in order to give it an icon.

For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.

Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size.


func get_plugin_icon():
# You can use a custom icon:
return preload("res://addons/my_plugin/my_plugin_icon.svg")
# Or use a built-in icon:
return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")

@:native("GetPluginName")getPluginName():String

Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor.

For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.

@:native("GetScriptCreateDialog")getScriptCreateDialog():ScriptCreateDialog

Gets the Editor's dialogue used for making scripts.

Note: Users can configure it before use.

Warning: Removing and freeing this node will render a part of the editor useless and may cause a crash.

@:native("GetState")getState():Dictionary

Gets the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns).

@:native("GetUndoRedo")getUndoRedo():UndoRedo

Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.

@:native("GetWindowLayout")getWindowLayout(layout:ConfigFile):Void

Gets the GUI layout of the plugin. This is used to save the project's editor layout when godot.EditorPlugin.queueSaveLayout is called or the editor layout was changed(For example changing the position of a dock).

@:native("Handles")handles(object:Object):Bool

Implement this function if your plugin edits a specific type of object (Resource or Node). If you return true, then you will get the functions godot.EditorPlugin.edit and godot.EditorPlugin.makeVisible called when the editor requests them. If you have declared the methods godot.EditorPlugin.forwardCanvasGuiInput and godot.EditorPlugin.forwardSpatialGuiInput these will be called too.

@:native("HasMainScreen")hasMainScreen():Bool

Returns true if this is a main screen editor plugin (it goes in the workspace selector together with 2D, 3D, Script and AssetLib).

@:native("HideBottomPanel")hideBottomPanel():Void

Minimizes the bottom panel.

@:native("MakeBottomPanelItemVisible")makeBottomPanelItemVisible(item:Control):Void

Makes a specific item in the bottom panel visible.

@:native("MakeVisible")makeVisible(visible:Bool):Void

This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.

Remember that you have to manage the visibility of all your editor controls manually.

@:native("QueueSaveLayout")queueSaveLayout():Void

Queue save the project's editor layout.

@:native("RemoveAutoloadSingleton")removeAutoloadSingleton(name:String):Void

Removes an Autoload name from the list.

@:native("RemoveControlFromBottomPanel")removeControlFromBottomPanel(control:Control):Void

Removes the control from the bottom panel. You have to manually godot.Node.queueFree the control.

@:native("RemoveControlFromContainer")removeControlFromContainer(container:EditorPlugin_CustomControlContainer, control:Control):Void

Removes the control from the specified container. You have to manually godot.Node.queueFree the control.

@:native("RemoveControlFromDocks")removeControlFromDocks(control:Control):Void

Removes the control from the dock. You have to manually godot.Node.queueFree the control.

@:native("RemoveCustomType")removeCustomType(type:String):Void

Removes a custom type added by godot.EditorPlugin.addCustomType.

@:native("RemoveExportPlugin")removeExportPlugin(plugin:EditorExportPlugin):Void

Removes an export plugin registered by godot.EditorPlugin.addExportPlugin.

@:native("RemoveImportPlugin")removeImportPlugin(importer:EditorImportPlugin):Void

Removes an import plugin registered by godot.EditorPlugin.addImportPlugin.

@:native("RemoveInspectorPlugin")removeInspectorPlugin(plugin:EditorInspectorPlugin):Void

Removes an inspector plugin registered by godot.EditorPlugin.addImportPlugin

@:native("RemoveSceneImportPlugin")removeSceneImportPlugin(sceneImporter:EditorSceneImporter):Void

Removes a scene importer registered by godot.EditorPlugin.addSceneImportPlugin.

@:native("RemoveSpatialGizmoPlugin")removeSpatialGizmoPlugin(plugin:EditorSpatialGizmoPlugin):Void

Removes a gizmo plugin registered by godot.EditorPlugin.addSpatialGizmoPlugin.

@:native("RemoveToolMenuItem")removeToolMenuItem(name:String):Void

Removes a menu name from Project > Tools.

@:native("SaveExternalData")saveExternalData():Void

This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.

@:native("SetForceDrawOverForwardingEnabled")setForceDrawOverForwardingEnabled():Void

Enables calling of godot.EditorPlugin.forwardCanvasForceDrawOverViewport for the 2D editor and godot.EditorPlugin.forwardSpatialForceDrawOverViewport for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.

@:native("SetInputEventForwardingAlwaysEnabled")setInputEventForwardingAlwaysEnabled():Void

Use this method if you always want to receive inputs from 3D view screen inside godot.EditorPlugin.forwardSpatialGuiInput. It might be especially usable if your plugin will want to use raycast in the scene.

@:native("SetState")setState(state:Dictionary):Void

Restore the state saved by godot.EditorPlugin.getState.

@:native("SetWindowLayout")setWindowLayout(layout:ConfigFile):Void

Restore the plugin GUI layout saved by godot.EditorPlugin.getWindowLayout.

Inherited Variables

Defined by Node

@:native("_ImportPath")_ImportPath:NodePath

@:native("CustomMultiplayer")customMultiplayer:MultiplayerAPI

The override to the default godot.MultiplayerAPI. Set to null to use the default godot.SceneTree one.

@:native("EditorDescription")editorDescription:String

@:native("Filename")filename:String

If a scene is instantiated from a file, its topmost node contains the absolute file path from which it was loaded in godot.Node.filename (e.g. res://levels/1.tscn). Otherwise, godot.Node.filename is set to an empty string.

@:native("Multiplayer")read onlymultiplayer:MultiplayerAPI

The godot.MultiplayerAPI instance associated with this node. Either the godot.Node.customMultiplayer, or the default SceneTree one (if inside tree).

@:native("Name")name:String

The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed.

Note: Auto-generated names might include the @ character, which is reserved for unique names when using godot.Node.addChild. When setting the name manually, any @ will be removed.

read onlyonReady:Signal<() ‑> Void>

ready signal.

read onlyonRenamed:Signal<() ‑> Void>

renamed signal.

read onlyonTreeEntered:Signal<() ‑> Void>

tree_entered signal.

read onlyonTreeExited:Signal<() ‑> Void>

tree_exited signal.

read onlyonTreeExiting:Signal<() ‑> Void>

tree_exiting signal.

@:native("Owner")owner:Node

The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using godot.PackedScene), all the nodes it owns will be saved with it. This allows for the creation of complex godot.SceneTrees, with instancing and subinstancing.

Note: If you want a child to be persisted to a godot.PackedScene, you must set godot.Node.owner in addition to calling godot.Node.addChild. This is typically relevant for [https://docs.godotengine.org/en/3.4/tutorials/misc/running_code_in_the_editor.html](tool scripts) and [https://docs.godotengine.org/en/3.4/tutorials/plugins/editor/index.html](editor plugins). If godot.Node.addChild is called without setting godot.Node.owner, the newly added godot.Node will not be visible in the scene tree, though it will be visible in the 2D/3D view.

@:native("PauseMode")pauseMode:Node_PauseModeEnum

Pause mode. How the node will behave if the godot.SceneTree is paused.

@:native("ProcessPriority")processPriority:Int

The node's priority in the execution order of the enabled processing callbacks (i.e. godot.Node.notificationProcess, godot.Node.notificationPhysicsProcess and their internal counterparts). Nodes whose process priority value is lower will have their processing callbacks executed first.

Defined by Object

@:native("DynamicObject")read onlydynamicObject:Dynamic

Gets a new godot.DynamicGodotObject associated with this instance.

@:native("NativeInstance")read onlynativeInstance:IntPtr

The pointer to the native instance of this godot.Object.

read onlyonScriptChanged:Signal<() ‑> Void>

script_changed signal.

Inherited Methods

Defined by Node

@:native("_EnterTree")_EnterTree():Void

Called when the node enters the godot.SceneTree (e.g. upon instancing, scene changing, or after calling godot.Node.addChild in a script). If the node has children, its godot.Node._EnterTree callback will be called first, and then that of the children.

Corresponds to the godot.Node.notificationEnterTree notification in godot.Object._Notification.

@:native("_ExitTree")_ExitTree():Void

Called when the node is about to leave the godot.SceneTree (e.g. upon freeing, scene changing, or after calling godot.Node.removeChild in a script). If the node has children, its godot.Node._ExitTree callback will be called last, after all its children have left the tree.

Corresponds to the godot.Node.notificationExitTree notification in godot.Object._Notification and signal tree_exiting. To get notified when the node has already left the active tree, connect to the tree_exited.

@:native("_GetConfigurationWarning")_GetConfigurationWarning():String

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 godot.Node.updateConfigurationWarning when the warning needs to be updated for this node.

@:native("_Input")_Input(event:InputEvent):Void

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 godot.Node.setProcessInput.

To consume the input event and stop it propagating further to other nodes, godot.SceneTree.setInputAsHandled can be called.

For gameplay input, godot.Node._UnhandledInput and godot.Node._UnhandledKeyInput are usually a better fit as they allow the GUI to intercept the events first.

Note: This method is only called if the node is present in the scene tree (i.e. if it's not orphan).

@:native("_PhysicsProcess")_PhysicsProcess(delta:Single):Void

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. delta is in seconds.

It is only called if physics processing is enabled, which is done automatically if this method is overridden, and can be toggled with godot.Node.setPhysicsProcess.

Corresponds to the godot.Node.notificationPhysicsProcess notification in godot.Object._Notification.

Note: This method is only called if the node is present in the scene tree (i.e. if it's not orphan).

@:native("_Process")_Process(delta:Single):Void

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. delta is in seconds.

It is only called if processing is enabled, which is done automatically if this method is overridden, and can be toggled with godot.Node.setProcess.

Corresponds to the godot.Node.notificationProcess notification in godot.Object._Notification.

Note: This method is only called if the node is present in the scene tree (i.e. if it's not orphan).

@:native("_Ready")_Ready():Void

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 godot.Node._Ready callbacks get triggered first, and the parent node will receive the ready notification afterwards.

Corresponds to the godot.Node.notificationReady notification in godot.Object._Notification. See also the onready keyword for variables.

Usually used for initialization. For even earlier initialization, may be used. See also godot.Node._EnterTree.

Note: godot.Node._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 godot.Node.requestReady, which may be called anywhere before adding the node again.

@:native("_UnhandledInput")_UnhandledInput(event:InputEvent):Void

Called when an godot.InputEvent hasn't been consumed by godot.Node._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 godot.Node.setProcessUnhandledInput.

To consume the input event and stop it propagating further to other nodes, godot.SceneTree.setInputAsHandled can be called.

For gameplay input, this and godot.Node._UnhandledKeyInput are usually a better fit than godot.Node._Input as they allow the GUI to intercept the events first.

Note: This method is only called if the node is present in the scene tree (i.e. if it's not orphan).

@:native("_UnhandledKeyInput")_UnhandledKeyInput(event:InputEventKey):Void

Called when an godot.InputEventKey hasn't been consumed by godot.Node._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 godot.Node.setProcessUnhandledKeyInput.

To consume the input event and stop it propagating further to other nodes, godot.SceneTree.setInputAsHandled can be called.

For gameplay input, this and godot.Node._UnhandledInput are usually a better fit than godot.Node._Input as they allow the GUI to intercept the events first.

Note: This method is only called if the node is present in the scene tree (i.e. if it's not orphan).

@:native("AddChild")addChild(node:Node, ?legibleUniqueName:Bool):Void

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 a 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 godot.Node.removeChild first to remove the node from its current parent. For example:


if child_node.get_parent():
child_node.get_parent().remove_child(child_node)
add_child(child_node)

Note: If you want a child to be persisted to a godot.PackedScene, you must set godot.Node.owner in addition to calling godot.Node.addChild. This is typically relevant for [https://docs.godotengine.org/en/3.4/tutorials/misc/running_code_in_the_editor.html](tool scripts) and [https://docs.godotengine.org/en/3.4/tutorials/plugins/editor/index.html](editor plugins). If godot.Node.addChild is called without setting godot.Node.owner, the newly added godot.Node will not be visible in the scene tree, though it will be visible in the 2D/3D view.

@:native("AddChildBelowNode")addChildBelowNode(node:Node, childNode:Node, ?legibleUniqueName:Bool):Void

Adds child_node as a child. The child is placed below the given node in the list of children.

If legible_unique_name is true, the child node will have a human-readable name based on the name of the node being instanced instead of its type.

@:native("AddToGroup")addToGroup(group:String, ?persistent:Bool):Void

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 godot.Node.isInsideTree). See notes in the description, and the group methods in godot.SceneTree.

The persistent option is used when packing node to godot.PackedScene and saving to file. Non-persistent groups aren't stored.

Note: For performance reasons, the order of node groups is not guaranteed. The order of node groups should not be relied upon as it can vary across project runs.

@:native("CanProcess")canProcess():Bool

Returns true if the node can process while the scene tree is paused (see godot.Node.pauseMode). Always returns true if the scene tree is not paused, and false if the node is not in the tree.

@:native("Duplicate")duplicate(?flags:Int):Node

Duplicates the node, returning a new node.

You can fine-tune the behavior using the flags (see godot.Node_DuplicateFlags).

Note: It will not work properly if the node contains a script with constructor arguments (i.e. needs to supply arguments to method). In that case, the node will be duplicated without a script.

@:native("FindNode")findNode(mask:String, ?recursive:Bool, ?owned:Bool):Node

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 "."). Returns null if no matching godot.Node is found.

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.

Note: As this method walks through all the descendants of the node, it is the slowest way to get a reference to another node. Whenever possible, consider using godot.Node.getNode instead. To avoid using godot.Node.findNode too often, consider caching the node reference into a variable.

@:native("FindParent")findParent(mask:String):Node

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.

Note: As this method walks upwards in the scene tree, it can be slow in large, deeply nested scene trees. Whenever possible, consider using godot.Node.getNode instead. To avoid using godot.Node.findParent too often, consider caching the node reference into a variable.

@:native("GetChild")getChild(idx:Int):Node

Returns a child node by its index (see godot.Node.getChildCount). This method is often used for iterating all children of a node.

To access a child node via its name, use godot.Node.getNode.

@:native("GetChildCount")getChildCount():Int

Returns the number of child nodes.

@:native("GetChildOrNull")getChildOrNull<M0>(idx:Int):M0

@:native("GetChildren")getChildren():Array

Returns an array of references to node's children.

@:native("GetCustomMultiplayer")getCustomMultiplayer():MultiplayerAPI

@:native("GetFilename")getFilename():String

@:native("GetGroups")getGroups():Array

Returns an array listing the groups that the node is a member of.

Note: For performance reasons, the order of node groups is not guaranteed. The order of node groups should not be relied upon as it can vary across project runs.

Note: The engine uses some group names internally (all starting with an underscore). To avoid conflicts with internal groups, do not add custom groups whose name starts with an underscore. To exclude internal groups while looping over godot.Node.getGroups, use the following snippet:


# Stores the node's non-internal groups only (as an array of Strings).
var non_internal_groups = []
for group in get_groups():
if not group.begins_with("_"):
non_internal_groups.push_back(group)

@:native("GetIndex")getIndex():Int

Returns the node's index, i.e. its position among the siblings of its parent.

@:native("GetMultiplayer")getMultiplayer():MultiplayerAPI

@:native("GetName")getName():String

@:native("GetNetworkMaster")getNetworkMaster():Int

Returns the peer ID of the network master for this node. See godot.Node.setNetworkMaster.

@:native("GetNode")getNode(path:NodePath):Node

Fetches a node. The godot.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 godot.Node.isInsideTree).

Example: Assume your current node is Character and the following tree:


/root
/root/Character
/root/Character/Sword
/root/Character/Backpack/Dagger
/root/MyGame
/root/Swamp/Alligator
/root/Swamp/Mosquito
/root/Swamp/Goblin

Possible paths are:


get_node("Sword")
get_node("Backpack/Dagger")
get_node("../Swamp/Alligator")
get_node("/root/MyGame")

@:native("GetNodeAndResource")getNodeAndResource(path:NodePath):Array

Fetches a node and one of its resources as specified by the godot.NodePath's subname (e.g. Area2D/CollisionShape2D:shape). If several nested resources are specified in the godot.NodePath, the last one will be fetched.

The return value is an array of size 3: the first index points to the godot.Node (or null if not found), the second index points to the godot.Resource (or null if not found), and the third index is the remaining godot.NodePath, if any.

For example, assuming that Area2D/CollisionShape2D is a valid node and that its shape property has been assigned a godot.RectangleShape2D resource, one could have this kind of output:


print(get_node_and_resource("Area2D/CollisionShape2D")) # [[CollisionShape2D:1161], Null, ]
print(get_node_and_resource("Area2D/CollisionShape2D:shape")) # [[CollisionShape2D:1161], [RectangleShape2D:1156], ]
print(get_node_and_resource("Area2D/CollisionShape2D:shape:extents")) # [[CollisionShape2D:1161], [RectangleShape2D:1156], :extents]

@:native("GetNodeOrNull")getNodeOrNull(path:NodePath):Node

Similar to godot.Node.getNode, but does not log an error if path does not point to a valid godot.Node.

@:native("GetOwner")getOwner():Node

@:native("GetOwnerOrNull")getOwnerOrNull<M0>():M0

@:native("GetParent")getParent():Node

Returns the parent node of the current node, or a null instance if the node lacks a parent.

@:native("GetParentOrNull")getParentOrNull<M0>():M0

@:native("GetPath")getPath():NodePath

Returns the absolute path of the current node. This only works if the current node is inside the scene tree (see godot.Node.isInsideTree).

@:native("GetPathTo")getPathTo(node:Node):NodePath

Returns the relative godot.NodePath from this node to the specified node. Both nodes must be in the same scene or the function will fail.

@:native("GetPauseMode")getPauseMode():Node_PauseModeEnum

@:native("GetPhysicsProcessDeltaTime")getPhysicsProcessDeltaTime():Single

Returns the time elapsed (in seconds) since the last physics-bound frame (see godot.Node._PhysicsProcess). This is always a constant value in physics processing unless the frames per second is changed via godot.Engine.iterationsPerSecond.

@:native("GetPositionInParent")getPositionInParent():Int

Returns the node's order in the scene tree branch. For example, if called on the first child node the position is 0.

@:native("GetProcessDeltaTime")getProcessDeltaTime():Single

Returns the time elapsed (in seconds) since the last process callback. This value may vary from frame to frame.

@:native("GetProcessPriority")getProcessPriority():Int

@:native("GetSceneInstanceLoadPlaceholder")getSceneInstanceLoadPlaceholder():Bool

Returns true if this is an instance load placeholder. See godot.InstancePlaceholder.

@:native("GetTree")getTree():SceneTree

Returns the godot.SceneTree that contains this node.

@:native("GetViewport")getViewport():Viewport

Returns the node's godot.Viewport.

@:native("HasNode")hasNode(path:NodePath):Bool

Returns true if the node that the godot.NodePath points to exists.

@:native("HasNodeAndResource")hasNodeAndResource(path:NodePath):Bool

Returns true if the godot.NodePath points to a valid node and its subname points to a valid resource, e.g. Area2D/CollisionShape2D:shape. Properties with a non-godot.Resource type (e.g. nodes or primitive math types) are not considered resources.

@:native("IsAParentOf")isAParentOf(node:Node):Bool

Returns true if the given node is a direct or indirect child of the current node.

@:native("IsDisplayedFolded")isDisplayedFolded():Bool

Returns true if the node is folded (collapsed) in the Scene dock.

@:native("IsGreaterThan")isGreaterThan(node:Node):Bool

Returns true if the given node occurs later in the scene hierarchy than the current node.

@:native("IsInGroup")isInGroup(group:String):Bool

Returns true if this node is in the specified group. See notes in the description, and the group methods in godot.SceneTree.

@:native("IsInsideTree")isInsideTree():Bool

Returns true if this node is currently inside a godot.SceneTree.

@:native("IsNetworkMaster")isNetworkMaster():Bool

Returns true if the local system is the master of this node.

@:native("IsPhysicsProcessing")isPhysicsProcessing():Bool

Returns true if physics processing is enabled (see godot.Node.setPhysicsProcess).

@:native("IsPhysicsProcessingInternal")isPhysicsProcessingInternal():Bool

Returns true if internal physics processing is enabled (see godot.Node.setPhysicsProcessInternal).

@:native("IsProcessing")isProcessing():Bool

Returns true if processing is enabled (see godot.Node.setProcess).

@:native("IsProcessingInput")isProcessingInput():Bool

Returns true if the node is processing input (see godot.Node.setProcessInput).

@:native("IsProcessingInternal")isProcessingInternal():Bool

Returns true if internal processing is enabled (see godot.Node.setProcessInternal).

@:native("IsProcessingUnhandledInput")isProcessingUnhandledInput():Bool

Returns true if the node is processing unhandled input (see godot.Node.setProcessUnhandledInput).

@:native("IsProcessingUnhandledKeyInput")isProcessingUnhandledKeyInput():Bool

Returns true if the node is processing unhandled key input (see godot.Node.setProcessUnhandledKeyInput).

@:native("MoveChild")moveChild(childNode:Node, toPosition:Int):Void

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.

@:native("PrintStrayNodes")printStrayNodes():Void

Prints all stray nodes (nodes outside the godot.SceneTree). Used for debugging. Works only in debug builds.

@:native("PrintTree")printTree():Void

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 godot.Node.getNode function.

Example output:


TheGame
TheGame/Menu
TheGame/Menu/Label
TheGame/Menu/Camera2D
TheGame/SplashScreen
TheGame/SplashScreen/Camera2D

@:native("PrintTreePretty")printTreePretty():Void

Similar to godot.Node.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:


â”–â•´TheGame
â” â•´Menu
┃  ┠╴Label
┃  ┖╴Camera2D
â”–â•´SplashScreen
â”–â•´Camera2D

@:native("PropagateCall")propagateCall(method:String, ?args:Array, ?parentFirst:Bool):Void

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.

Parameters:

args

If the parameter is null, then the default value is new Godot.Collections.Array { }

@:native("PropagateNotification")propagateNotification(what:Int):Void

Notifies the current node and all its children recursively by calling godot.Object.notification on all of them.

@:native("QueueFree")queueFree():Void

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 godot.Object.free. Use godot.Object.isQueuedForDeletion to check whether a node will be deleted at the end of the frame.

Important: If you have a variable pointing to a node, it will not be assigned to null once the node is freed. Instead, it will point to a previously freed instance and you should validate it with @GDScript.is_instance_valid before attempting to call its methods or access its properties.

@:native("Raise")raise():Void

Moves this node to the bottom of parent node's children hierarchy. This is often useful in GUIs (godot.Control nodes), because their order of drawing depends on their order in the tree. The top Node is drawn first, then any siblings below the top Node in the hierarchy are successively drawn on top of it. After using raise, a Control will be drawn on top of its siblings.

@:native("RemoveAndSkip")removeAndSkip():Void

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.

@:native("RemoveChild")removeChild(node:Node):Void

Removes a child node. The node is NOT deleted and must be deleted manually.

Note: This function may set the godot.Node.owner of the removed Node (or its descendants) to be null, if that godot.Node.owner is no longer a parent or ancestor.

@:native("RemoveFromGroup")removeFromGroup(group:String):Void

Removes a node from a group. See notes in the description, and the group methods in godot.SceneTree.

@:native("ReplaceBy")replaceBy(node:Node, ?keepData:Bool):Void

Replaces a node in a scene by the given one. Subscriptions that pass through this node will be lost.

Note that the replaced node is not automatically freed, so you either need to keep it in a variable for later use or free it using godot.Object.free.

@:native("RequestReady")requestReady():Void

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 godot.Node._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).

@:native("Rpc")rpc(method:String, args:HaxeArray<Dynamic>):Dynamic

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 godot.NodePath, including the exact same node name. Behaviour depends on the RPC configuration for the given method, see godot.Node.rpcConfig. Methods are not exposed to RPCs by default. See also godot.Node.rset and godot.Node.rsetConfig for properties. Returns null.

Note: You can only safely use RPCs on clients after you received the connected_to_server signal from the godot.SceneTree. You also need to keep track of the connection state, either by the godot.SceneTree signals like server_disconnected or by checking SceneTree.network_peer.get_connection_status() == CONNECTION_CONNECTED.

@:native("RpcConfig")rpcConfig(method:String, mode:MultiplayerAPI_RPCMode):Void

Changes the RPC mode for the given method to the given mode. See godot.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 godot.Node.rset and godot.Node.rsetConfig for properties.

@:native("RpcId")rpcId(peerId:Int, method:String, args:HaxeArray<Dynamic>):Dynamic

Sends a godot.Node.rpc to a specific peer identified by peer_id (see godot.NetworkedMultiplayerPeer.setTargetPeer). Returns null.

@:native("RpcUnreliable")rpcUnreliable(method:String, args:HaxeArray<Dynamic>):Dynamic

Sends a godot.Node.rpc using an unreliable protocol. Returns null.

@:native("RpcUnreliableId")rpcUnreliableId(peerId:Int, method:String, args:HaxeArray<Dynamic>):Dynamic

Sends a godot.Node.rpc to a specific peer identified by peer_id using an unreliable protocol (see godot.NetworkedMultiplayerPeer.setTargetPeer). Returns null.

@:native("Rset")rset(property:String, value:Dynamic):Void

Remotely changes a property's value on other peers (and locally). Behaviour depends on the RPC configuration for the given property, see godot.Node.rsetConfig. See also godot.Node.rpc for RPCs for methods, most information applies to this method as well.

@:native("RsetConfig")rsetConfig(property:String, mode:MultiplayerAPI_RPCMode):Void

Changes the RPC mode for the given property to the given mode. See godot.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 godot.Node.rpc and godot.Node.rpcConfig for methods.

@:native("RsetId")rsetId(peerId:Int, property:String, value:Dynamic):Void

Remotely changes the property's value on a specific peer identified by peer_id (see godot.NetworkedMultiplayerPeer.setTargetPeer).

@:native("RsetUnreliable")rsetUnreliable(property:String, value:Dynamic):Void

Remotely changes the property's value on other peers (and locally) using an unreliable protocol.

@:native("RsetUnreliableId")rsetUnreliableId(peerId:Int, property:String, value:Dynamic):Void

Remotely changes property's value on a specific peer identified by peer_id using an unreliable protocol (see godot.NetworkedMultiplayerPeer.setTargetPeer).

@:native("SetCustomMultiplayer")setCustomMultiplayer(api:MultiplayerAPI):Void

@:native("SetDisplayFolded")setDisplayFolded(fold:Bool):Void

Sets the folded state of the node in the Scene dock.

@:native("SetFilename")setFilename(filename:String):Void

@:native("SetName")setName(name:String):Void

@:native("SetNetworkMaster")setNetworkMaster(id:Int, ?recursive:Bool):Void

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.

@:native("SetOwner")setOwner(owner:Node):Void

@:native("SetPauseMode")setPauseMode(mode:Node_PauseModeEnum):Void

@:native("SetPhysicsProcess")setPhysicsProcess(enable:Bool):Void

Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a godot.Node.notificationPhysicsProcess at a fixed (usually 60 FPS, see godot.Engine.iterationsPerSecond to change) interval (and the godot.Node._PhysicsProcess callback will be called if exists). Enabled automatically if godot.Node._PhysicsProcess is overridden. Any calls to this before godot.Node._Ready will be ignored.

@:native("SetPhysicsProcessInternal")setPhysicsProcessInternal(enable:Bool):Void

Enables or disables internal physics for this node. Internal physics processing happens in isolation from the normal godot.Node._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 (godot.Node.setPhysicsProcess). Only useful for advanced uses to manipulate built-in nodes' behavior.

Warning: Built-in Nodes rely on the internal processing for their own logic, so changing this value from your code may lead to unexpected behavior. Script access to this internal logic is provided for specific advanced uses, but is unsafe and not supported.

@:native("SetProcess")setProcess(enable:Bool):Void

Enables or disables processing. When a node is being processed, it will receive a godot.Node.notificationProcess on every drawn frame (and the godot.Node._Process callback will be called if exists). Enabled automatically if godot.Node._Process is overridden. Any calls to this before godot.Node._Ready will be ignored.

@:native("SetProcessInput")setProcessInput(enable:Bool):Void

Enables or disables input processing. This is not required for GUI controls! Enabled automatically if godot.Node._Input is overridden. Any calls to this before godot.Node._Ready will be ignored.

@:native("SetProcessInternal")setProcessInternal(enable:Bool):Void

Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal godot.Node._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 (godot.Node.setProcess). Only useful for advanced uses to manipulate built-in nodes' behavior.

Warning: Built-in Nodes rely on the internal processing for their own logic, so changing this value from your code may lead to unexpected behavior. Script access to this internal logic is provided for specific advanced uses, but is unsafe and not supported.

@:native("SetProcessPriority")setProcessPriority(priority:Int):Void

@:native("SetProcessUnhandledInput")setProcessUnhandledInput(enable:Bool):Void

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 godot.Control). Enabled automatically if godot.Node._UnhandledInput is overridden. Any calls to this before godot.Node._Ready will be ignored.

@:native("SetProcessUnhandledKeyInput")setProcessUnhandledKeyInput(enable:Bool):Void

Enables unhandled key input processing. Enabled automatically if godot.Node._UnhandledKeyInput is overridden. Any calls to this before godot.Node._Ready will be ignored.

@:native("SetSceneInstanceLoadPlaceholder")setSceneInstanceLoadPlaceholder(loadPlaceholder:Bool):Void

Sets whether this is an instance load placeholder. See godot.InstancePlaceholder.

@:native("UpdateConfigurationWarning")updateConfigurationWarning():Void

Updates the warning displayed for this node in the Scene Dock.

Use godot.Node._GetConfigurationWarning to setup the warning message to display.

Defined by Object

@:native("_Get")_Get(property:String):Dynamic

Virtual method which can be overridden to customize the return value of godot.Object.get.

Returns the given property. Returns null if the property does not exist.

@:native("_GetPropertyList")_GetPropertyList():Array

Virtual method which can be overridden to customize the return value of godot.Object.getPropertyList.

Returns the object's property list as an godot.Collections_Array of dictionaries.

Each property's godot.Collections_Dictionary must contain at least name: String and type: int (see godot.Variant_Type) entries. Optionally, it can also include hint: int (see godot.PropertyHint), hint_string: String, and usage: int (see godot.PropertyUsageFlags).

@:native("_Notification")_Notification(what:Int):Void

Called whenever the object receives a notification, which is identified in what by a constant. The base godot.Object has two constants godot.Object.notificationPostinitialize and godot.Object.notificationPredelete, but subclasses such as godot.Node define a lot more notifications which are also received by this method.

@:native("_Set")_Set(property:String, value:Dynamic):Bool

Virtual method which can be overridden to customize the return value of godot.Object.set.

Sets a property. Returns true if the property exists.

@:native("AddUserSignal")addUserSignal(signal:String, ?arguments:Array):Void

Adds a user-defined signal. Arguments are optional, but can be added as an godot.Collections_Array of dictionaries, each containing name: String and type: int (see godot.Variant_Type) entries.

Parameters:

arguments

If the parameter is null, then the default value is new Godot.Collections.Array { }

@:native("Call")call(method:String, args:HaxeArray<Dynamic>):Dynamic

Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:


call("set", "position", Vector2(42.0, 0.0))

Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).

@:native("CallDeferred")callDeferred(method:String, args:HaxeArray<Dynamic>):Void

Calls the method on the object during idle time. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:


call_deferred("set", "position", Vector2(42.0, 0.0))

Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).

@:native("Callv")callv(method:String, argArray:Array):Dynamic

Calls the method on the object and returns the result. Contrarily to godot.Object.call, this method does not support a variable number of arguments but expects all parameters to be via a single godot.Collections_Array.


callv("set", [ "position", Vector2(42.0, 0.0) ])

@:native("CanTranslateMessages")canTranslateMessages():Bool

Returns true if the object can translate strings. See godot.Object.setMessageTranslation and godot.Object.tr.

@:native("Connect")connect(signal:String, target:Object, method:String, ?binds:Array, ?flags:UInt):Error

Connects a signal to a method on a target object. Pass optional binds to the call as an godot.Collections_Array of parameters. These parameters will be passed to the method after any parameter used in the call to godot.Object.emitSignal. Use flags to set deferred or one-shot connections. See godot.Object_ConnectFlags constants.

A signal can only be connected once to a method. It will print an error if already connected, unless the signal was connected with godot.Object_ConnectFlags.referenceCounted. To avoid this, first, use godot.Object.isConnected to check for existing connections.

If the target is destroyed in the game's lifecycle, the connection will be lost.

Examples:


connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signal

An example of the relationship between binds passed to godot.Object.connect and parameters used when calling godot.Object.emitSignal:


connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])

Parameters:

binds

If the parameter is null, then the default value is new Godot.Collections.Array { }

@:native("Disconnect")disconnect(signal:String, target:Object, method:String):Void

Disconnects a signal from a method on the given target.

If you try to disconnect a connection that does not exist, the method will print an error. Use godot.Object.isConnected to ensure that the connection exists.

@:native("Dispose")dispose():Void

@:native("Dispose")@:protectedDispose(disposing:Bool):Void

Disposes of this godot.Object.

@:native("EmitSignal")emitSignal(signal:String, args:HaxeArray<Dynamic>):Void

Emits the given signal. The signal must exist, so it should be a built-in signal of this class or one of its parent classes, or a user-defined signal. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:


emit_signal("hit", weapon_type, damage)
emit_signal("game_over")

@:native("Free")free():Void

Deletes the object from memory immediately. For godot.Nodes, you may want to use godot.Node.queueFree to queue the node for safe deletion at the end of the current frame.

Important: If you have a variable pointing to an object, it will not be assigned to null once the object is freed. Instead, it will point to a previously freed instance and you should validate it with @GDScript.is_instance_valid before attempting to call its methods or access its properties.

@:native("Get")get(property:String):Dynamic

Returns the Variant value of the given property. If the property doesn't exist, this will return null.

Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).

@:native("GetClass")getClass():String

Returns the object's class as a String. See also godot.Object.isClass.

Note: godot.Object.getClass does not take class_name declarations into account. If the object has a class_name defined, the base class name will be returned instead.

@:native("GetIncomingConnections")getIncomingConnections():Array

Returns an godot.Collections_Array of dictionaries with information about signals that are connected to the object.

Each godot.Collections_Dictionary contains three String entries:

  • source is a reference to the signal emitter.

  • signal_name is the name of the connected signal.

  • method_name is the name of the method to which the signal is connected.

@:native("GetIndexed")getIndexed(property:NodePath):Dynamic

Gets the object's property indexed by the given godot.NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Examples: "position:x" or "material:next_pass:blend_mode".

Note: Even though the method takes godot.NodePath argument, it doesn't support actual paths to godot.Nodes in the scene tree, only colon-separated sub-property paths. For the purpose of nodes, use godot.Node.getNodeAndResource instead.

@:native("GetInstanceId")getInstanceId():UInt64

Returns the object's unique instance ID.

This ID can be saved in godot.EncodedObjectAsID, and can be used to retrieve the object instance with @GDScript.instance_from_id.

@:native("GetMeta")getMeta(name:String):Dynamic

Returns the object's metadata entry for the given name.

inlinegetMetaList():Array<String>

Returns the object's metadata as a String.

@:native("GetMethodList")getMethodList():Array

Returns the object's methods and their signatures as an godot.Collections_Array.

@:native("GetPropertyList")getPropertyList():Array

Returns the object's property list as an godot.Collections_Array of dictionaries.

Each property's godot.Collections_Dictionary contain at least name: String and type: int (see godot.Variant_Type) entries. Optionally, it can also include hint: int (see godot.PropertyHint), hint_string: String, and usage: int (see godot.PropertyUsageFlags).

@:native("GetScript")getScript():Reference

Returns the object's godot.Script instance, or null if none is assigned.

@:native("GetSignalConnectionList")getSignalConnectionList(signal:String):Array

Returns an godot.Collections_Array of connections for the given signal.

@:native("GetSignalList")getSignalList():Array

Returns the list of signals as an godot.Collections_Array of dictionaries.

@:native("HasMeta")hasMeta(name:String):Bool

Returns true if a metadata entry is found with the given name.

@:native("HasMethod")hasMethod(method:String):Bool

Returns true if the object contains the given method.

@:native("HasSignal")hasSignal(signal:String):Bool

Returns true if the given signal exists.

@:native("HasUserSignal")hasUserSignal(signal:String):Bool

Returns true if the given user-defined signal exists. Only signals added using godot.Object.addUserSignal are taken into account.

@:native("IsBlockingSignals")isBlockingSignals():Bool

Returns true if signal emission blocking is enabled.

@:native("IsClass")isClass(class_:String):Bool

Returns true if the object inherits from the given class. See also godot.Object.getClass.

Note: godot.Object.isClass does not take class_name declarations into account. If the object has a class_name defined, godot.Object.isClass will return false for that name.

@:native("IsConnected")isConnected(signal:String, target:Object, method:String):Bool

Returns true if a connection exists for a given signal, target, and method.

@:native("IsQueuedForDeletion")isQueuedForDeletion():Bool

Returns true if the godot.Node.queueFree method was called for the object.

@:native("Notification")notification(what:Int, ?reversed:Bool):Void

Send a given notification to the object, which will also trigger a call to the godot.Object._Notification method of all classes that the object inherits from.

If reversed is true, godot.Object._Notification is called first on the object's own class, and then up to its successive parent classes. If reversed is false, godot.Object._Notification is called first on the highest ancestor (godot.Object itself), and then down to its successive inheriting classes.

@:native("PropertyListChangedNotify")propertyListChangedNotify():Void

Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.

@:native("RemoveMeta")removeMeta(name:String):Void

Removes a given entry from the object's metadata. See also godot.Object.setMeta.

@:native("Set")set(property:String, value:Dynamic):Void

Assigns a new value to the given property. If the property does not exist or the given value's type doesn't match, nothing will happen.

Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).

@:native("SetBlockSignals")setBlockSignals(enable:Bool):Void

If set to true, signal emission is blocked.

@:native("SetDeferred")setDeferred(property:String, value:Dynamic):Void

Assigns a new value to the given property, after the current frame's physics step. This is equivalent to calling godot.Object.set via godot.Object.callDeferred, i.e. call_deferred("set", property, value).

Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).

@:native("SetIndexed")setIndexed(property:NodePath, value:Dynamic):Void

Assigns a new value to the property identified by the godot.NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Example:


set_indexed("position", Vector2(42, 0))
set_indexed("position:y", -10)
print(position) # (42, -10)

@:native("SetMessageTranslation")setMessageTranslation(enable:Bool):Void

Defines whether the object can translate strings (with calls to godot.Object.tr). Enabled by default.

@:native("SetMeta")setMeta(name:String, value:Dynamic):Void

Adds, changes or removes a given entry in the object's metadata. Metadata are serialized and can take any Variant value.

To remove a given entry from the object's metadata, use godot.Object.removeMeta. Metadata is also removed if its value is set to null. This means you can also use set_meta("name", null) to remove metadata for "name".

@:native("SetScript")setScript(script:Reference):Void

Assigns a script to the object. Each object can have a single script assigned to it, which are used to extend its functionality.

If the object already had a script, the previous script instance will be freed and its variables and state will be lost. The new script's method will be called.

@:native("ToSignal")toSignal(source:Object, signal:String):SignalAwaiter

Returns a new godot.SignalAwaiter awaiter configured to complete when the instance source emits the signal specified by the signal parameter.

Parameters:

source

The instance the awaiter will be listening to.

signal

The signal the awaiter will be waiting for. This sample prints a message once every frame up to 100 times.

public override void _Ready()
{
for (int i = 0; i &lt; 100; i++)
{
await ToSignal(GetTree(), "idle_frame");
GD.Print($"Frame {i}");
}
}

Returns:

A godot.SignalAwaiter that completes when source emits the signal.

@:native("ToString")toString():String

Converts this godot.Object to a string.

Returns:

A string representation of this object.

@:native("Tr")tr(message:String):String

Translates a message using translation catalogs configured in the Project Settings.

Only works if message translation is enabled (which it is by default), otherwise it returns the message unchanged. See godot.Object.setMessageTranslation.