Usage
Basic Usage
- Navigate to the plugin dock. By default, it is placed in the bottom left dock slot.
- Write anything in GDScript, e.g.
print("Hello world!")
- Click Run
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.
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.
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.
Similarly, always start NodePaths with ^".."
.
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.
- Changes made with code cannot be undone.
- While existing nodes can be edited and freed, new nodes cannot be added to the open scene.
static
variables cannot be declared.- You may want to look into the Prefix Command instead.
-
Lambda functions
must be used instead of normal functions.
# Instead of this:
func foo():
foo()print("bar")
# Do this:
var foo = func():
foo.call()print("bar")