How to create a new node in code godot code example
Example 1: how to instance in a node with code godot
#Load the resourse using preload
const MySmokeResource = preload("res://SmokeScene.tscn")
func _ready():
#Make instance
var GrabedInstance= MySmokeResource.instance()
#You could now make changes to the new instance if you wanted
CurrentEntry.name = "SmokeA"
#Attach it to the tree
self.add_child(GrabedInstance)
Example 2: How to create a new node in godot
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())