[7061-untitled-1+copy.jpg|7061]
I’m trying to create a wall of cubes with this code,
but for some reason its skipped the first spot and start it into second with the “0-0”
like in the the image.
float cubeWidth = 0.98f;
float cubeHeight = 0.98f;
void Start()
{
GameObject cube = new GameObject();
-- reference for the next instances
float referenceX = -2.938817f;
float referenceY = -2.109755f;
float referenceZ = 3.623962e-05f;
for (int i = 0; i <= 5; i++)
{
for (int j = 0; j <= 6; j++)
{
Vector3 position_ = new Vector3(referenceX +
j * cubeWidth, referenceY + i * cubeHeight, 0);
cube.transform.position = position_;
cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
--show their names
cube.name = "" + i + "-" + j;
}
}
}