`I am using this code to create some nodes and see them in the editor using a tool script
@tool
@export var categories: Array[CategoryRes]
@export var init_cats: bool:
set(ticked):
if not ticked: return
_init_cats()
func _init_cats():
# Add the categories as children
for res in categories:
var cat = Category.new(res.texture, res.title, max_items)
add_child(cat)
cat.set_owner(get_tree().get_root())
I would guess Set/Get style buttons like this could run before the scene tree is fully setup.
You could probably add an ‘is_started’ variable and set to true on ready, then have the init_cats function check this first. (I believe this would be resolved by the new editor button decorators in the 4.4 builds if so)
Also I habitually use “get_edited_scene_root()” rather than get_root(). Could be related, but not at computer to check.