Add node from editor script with tool-mode

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Roket

I want to do something like this:

tool

func _ready():
    var node = preload("....").inctance()
    add_child(node)

But this code adds a node to root/EditorNode. So when I start the application, I do not see the node on the stage.

Is it possible to implement this feature?

So that you can create nods through edits automatically, and add them to the scene?

I believe you want something similar to this other question: https://forum.godotengine.org/15486/create-nodes-in-the-editor-from-script

tastyshrimp | 2020-01-07 21:38

:bust_in_silhouette: Reply From: johnygames

I think you need to set the owner of the instance for it to show: