Not all resources can be instanciated. When you load one, you already get that resource itself (eventually you can duplicate by calling duplicate()
it but that's probably not what you are looking for).
"Instancing" refers only to scene resources (i.e PackedScene
), so when you load a scene, you can instance it by calling its instance()
function. It returns the root node of the instance, which you can then add to the tree by calling add_child()
on the parent node you want.
If, however, you mean creating a resource from scratch, or even nodes (i.e generate it, not loading one from disk), I have no idea if that works in VisualScript. In GDScipt that would just be ResourceType.new()
or NodeType.new()
, but I'm failing to find an actual equivalent here. The closest I got was to create a new member variable in the list on the left, which might be enough in some cases but not if you intend to create multiple ones in a loop, or create nodes.