Ok, using two for loops one can create a a grid of cubes, just instantiate a cube increasingly on the x and y axis. How would one do this to create a circle or a ring?

Thanks guys in advanced!

Ok, using two for loops one can create a a grid of cubes, just instantiate a cube increasingly on the x and y axis. How would one do this to create a circle or a ring?

Thanks guys in advanced!

Thanks guys, found the answer though. I just derived the x and y values from cosine and sin.

```
public GameObject cube;
void Start()
{
int x, y;
int length = 50;
float angle = 0.0f;
float interval = 0.1f;
while (angle < 2 * Mathf.PI)
{
x = (int)(length * Mathf.Cos (angle));
y = (int)(length * Mathf.Sin (angle));
Instantiate(cube,new Vector3(x,y,0),Quaternion.identity);
angle += interval;
}
}
```

For people who are trying to do this in 3D space , you just have to do is to change y to z

so code will be something like this

public GameObject cube;

```
void Start()
{
int x, z;
int length = 50;
float angle = 0.0f;
float interval = 0.1f;
while (angle < 2 * Mathf.PI)
{
x = (int)(length * Mathf.Cos (angle));
z = (int)(length * Mathf.Sin (angle));
Instantiate(cube,new Vector3(x,0,z),Quaternion.identity);
angle += interval;
}
```

base code by SnotE101