Usage

Basic Usage

All code you write is run in the editor. Ensure that code you run will not have unintended consequences.

If, for example, your code contains an infinite loop, the editor will hang and you may lose data.

while true:
	pass # Do not attempt!

Editing the Open Scene

When you click Run, your code is copied into the _ready function of a new node. If a scene is open, this node is parented to the scene's root. Otherwise, it is parented to the editor's root.

This behavior allows you to modify the open scene with code that you run.

# Get the root node's children
var children = $"..".get_children()
for i in children.size():
	children[i].position.x = i * 64.0

Always start node references with $".." to get the scene's root node.

var node = $".."/Path/To/Node

Similarly, always start NodePaths with ^"..".

var node = get_node(^"../Path/To/Node")

Also note that the @onready annotation is not needed because code is pasted into the _ready function.

Limitations

Below is a list of some of GDTerminal's limitations.