Hi,
I'm trying to create a map from tiles. Here is my tile scene:

The script is really easy, I'm just starting, but the idea is to add more thing in the future:
class_name EmptyTile
extends Spatial
Now the "game manager" is a Control
node with the script:
extends Control
var sizeX : int = 11
var semiSizeX : int = sizeX%2
var sizeZ : int = 11
var semiSizeZ : int = sizeZ%2
var ttile = preload("res://Assets/Tiles/EmptyTile/EmptyTile.tscn")
func _init():
var tilesTranslations : Array = []
for i in range(sizeX):
for j in range(sizeZ):
tilesTranslations.append(Vector3(-semiSizeX + i, 0, -semiSizeZ + j))
var currTile : Spatial
for i in range(tilesTranslations.size()):
currTile = ttile.instance() #EmptyTile.new() # here is the problem, see bellow
currTile.translation = tilesTranslations[i]
currTile.name = var2str(tilesTranslations[i])
add_child(currTile)
var camera = Camera.new()
camera.translation = Vector3(0, 1, 5) # just placing the camera in to see something
add_child(camera)
Now, the problem, when I use currTile = ttile.instance()
this is the output:

note you can see Remote on the left side.
Now if I use the way I want currTile = EmptyTile.new()
:

As you can see now, the MeshInstance
is not added. What is happening? I want to use .new()
.