xxxxxxxxxx
var node = Spatial.new()
# the parent can be get_tree().get_root() or some other node
parent.add_child(node)
# ownership is different, I think it's not the same root as the root node
node.set_owner(get_tree().get_edited_scene_root())
xxxxxxxxxx
tool
extends EditorPlugin
func _enter_tree():
# Initialization of the plugin goes here.
# Add the new type with a name, a parent type, a script and an icon.
add_custom_type("MyButton", "Button", preload("my_button.gd"), preload("icon.png"))
func _exit_tree():
# Clean-up of the plugin goes here.
# Always remember to remove it from the engine when deactivated.
remove_custom_type("MyButton")