using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MapGen : MonoBehaviour
{
public GameObject prefab;
public float gridX = 5f;
public float gridY = 5f;
public float offset;
public float spacing = 2f;
void Start()
{
for (int y = 0; y < gridY; y++)
{
for (int x = 0; x < gridX; x++)
{
Vector3 pos = new Vector3(x, y, 0) * spacing;
Instantiate(prefab, pos, Quaternion.identity);
}
}
}
}
Thanks for the reply! I just gave that a whirl and it seems to be mushing them into each other - forgive me if I am missing something. Please see image of what I am trying to achieve: https://imgur.com/a/v9i9stU
Well that is what my code will do.
For the first column it moves it 0 x - 0.25f, the next 1 x -0.25f, then 2 x -0.25f,…
Maybe you just need to add “1” ?
float yOffset = (1 + y) * -0.25f;