#Auto-add-node not working

7 messages · Page 1 of 1 (latest)

gusty burrow
#

I copy pasted your code and I see it.
Have you looked under the "Remote" tab while playing?

urban shell
#

You seem like a visual learner; so I decided that you might prefer a youtube video that explains things step by step, and also shows it for you frame by frame.

#

Starts with var timer = Timer.new() -> add_child(timer), shows the node appearing under Remote while the game is running, and explains common pitfalls such as forgetting to set timer.one_shot, wait_time, or autostart.

https://youtu.be/1sYgGvrDYag?si=hDbOHtndVjHaVH8l

Here we'll create timers using 3 different methods in Godot 4. The basic method of adding an actual timer to the scene tree, then purely in code, then using the quick get_tree().create_timer(seconds) way.

Here's a link to my video on signals if you're struggling with those (warning it's lengthy): https://youtu.be/PFDbrj77HjI

Here's a link to m...

▶ Play video
snow oar
gusty burrow
#

On the @tool documentation they do this exact thing

func _ready():
    var node = Node3D.new()
    add_child(node) # Parent could be any node in the scene

    # The line below is required to make the node visible in the Scene tree dock
    # and persist changes made by the tool script to the saved scene file.
    node.owner = get_tree().edited_scene_root