Hello,
i’m pretty new to Unity and C# and maybe anyone can tell me if i made an error or if Unity does this and why?
I create a top down map with 10x10 tiles
public class tile_map : MonoBehaviour {
private Tilemap testmap;
public Tile gras;
public Vector2Int size;
// Use this for initialization
void Start () {
testmap = GetComponent<Tilemap>();
Camera.main.transform.position = new Vector3Int(size.x / 2, size.y / 2, -10);
Vector3Int[] position_array = new Vector3Int[size.x*size.y];
TileBase[] tile_array = new TileBase[position_array.Length];
int array_count = 0;
for(var x = 0; x < size.x; x++) {
for(var y = 0; y < size.y; y++) {
position_array[array_count] = new Vector3Int(x, y, 0);
tile_array[array_count] = gras;
array_count++;
}
}
testmap.SetTiles(position_array, tile_array);
}
and when do a Debug.Log(testmap.size) it always returns me “(10, 11, 1)”
Why is y = 11?
And why is z = 1? I set z = 0 in every vector.
Greetings,
Daniela