I am new to godot.
I am trying to make a script that instanced the same scene repeatedly but each instanced scene will have their individual variables set through the instance function so they all behave differently.
func blockinst(pos, type):
var instance = block.instantiate()
instance.position = pos
instance.tile = preload("res://Content/Tiles/Dirt/Dirt.tres") <- this is what is not working.
add_child(instance)
despite the instance.pos = pos correctly setting the position of the instance the instance.tile gives me this error:
Invalid assignment of property or key 'tile' with value of type 'Resource (Block)' on a base object of type 'Node3D'.
also blockinst(Vector3(0, 0, 0), wood) this is what triggers the function, it contains the location and what set of variables will be applied to the instance it is making, here it would be wood.
How can i get the variable to be assigned validly to the instance it is creating?