Hello, I’m trying to set each gameobject to his coordinates. Like the object at (0,0) is Gameobject0-0, and so on. I’m making this so when i press the down button, i can find the gameobject at my x pos rounded and my y pos rounded - 1. Can someone please help me, or give me a hint how i can make this? Thank you -Nelis
var prefab : GameObject;
var gridX = 5;
var gridY = 5;
private var spacing = 1;
var SpawnX;
var SpawnY;
function Start ()
{
for (var y = 0; y < gridY; y++){
for (var x = 0; x < gridX; x++){
var pos = Vector2(x,y) * spacing;
Instantiate(prefab, pos, Quaternion.identity);
}
}
}