#Auto-add-node not working
7 messages · Page 1 of 1 (latest)
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.
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...
In this Godot 4 tutorial, learn several debugging tips and techniques that are better than print()ing to the console. Learn about different print/error statements, use the Scene Tree to debug, and get a breakdown of the Godot debugger itself. With these and a few other Godot features you'll go from caveman debugging to hunting down bugs like a v...
oh I am sorry I didn't make it clear enough. I was meaning in the editor while eidting, I have it as @tool at the top as well and despite it, it never gets autoadded when I add the node. I am terribly sorry
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
What is@tool?:@tool is a powerful line of code that, when added at the top of your script, makes it execute in the editor. You can also decide which parts of the script execute in the editor, which...