Can someone help me with what might be a simple thing I am overlooking. The code below works as it should. I am trying to get it to work in a 2D plane. Meaning I am trying to get a 5 by 5 grid display along X,Y. Right now it’s X,Z. I tried playing around with Vector3 pos = new Vector3 (x, 0, y) * spacing; by changing the x,yz value and no luck.
Thanks for nay help.1
void GridFormation ()
{
float gridX = gridXCount;
float gridY = gridYCount;
for (int y = 0; y < gridY; y++) {
for (int x = 0; x < gridX; x++) {
Vector3 pos = new Vector3 (x, 0, y) * spacing;
Instantiate (prefab, pos, Quaternion.identity);
}
}
}
Thank @KelsoMRK but I tries your suggestion as well. I can remember how to do the offset. The prefabs stack on top of each other. I open to any other suggestions. And thanks
Stacking on top of each other is what I would expect from an evenly-spaced grid of prefabs along the X Y plane so I’m not really clear on what you’re trying to do at this point.