editor_add_node
Add a node to the scene open in the Godot editor. The node appears live and selected, supports undo with Ctrl+Z, and leaves the scene unsaved until you save it.
Instructions
Adds a node to the scene open in the Godot editor. It appears live and is selected; undo with Ctrl+Z. The scene is not saved until editor_save_scene (or the user saves). Prefer this over add_node while the editor is open.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| type | Yes | Godot Node class, e.g. "Sprite2D" | |
| properties | No | Godot-syntax values, e.g. { "position": "Vector2(10, 20)", "shape": "RectangleShape2D.new()", "shape:size": "Vector2(32, 48)" }. Strings need quotes ("\"hi\""); ClassName.new() creates a Resource; "prop:subprop" reaches into a resource. Applied in order. | |
| scene_path | No | Optional safety check: fail unless this is the scene currently open in the editor | |
| parent_path | Yes | Path of the parent node in the open scene, e.g. "." or "Player" | |
| script_path | No | Attach this script, e.g. res://scripts/coin.gd |