Usage

Basic Usage

  1. Navigate to the plugin dock. By default, it is placed in the bottom left dock slot.
  2. Write anything in GDScript, e.g. print("Hello world!").
  3. 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.

while true:
	pass # Do not attempt!

Also note that code that you run cannot be reverted.

If, for example, you make unwanted changes to a scene, you will need to close that scene without saving it in order to undo those modifications. This will cause you to lose any other unsaved changes you've made to the scene.

How Code Is Run

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.

Remember that anything that won't work in the _ready function won't work when running a command. The most common examples are outlined below.

Editing the Open Scene

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")

The @onready annotation is not needed because code is pasted into the _ready function.

Nodes that you add to scenes will not be saved or shown in the scene tree unless you set their owner.

var new_node = Node.new()
$"..".add_child(new_node)
new_node.owner = $".."