unity instantiate prefab in a circle code example
Example: unity instantiate prefab in a circle
void InstantiateCircle () { float angle = 360f / (float)pieceCount; for (int i = 0; i < pieceCount; i++) { Quaternion rotation = Quaternion.AngleAxis(i * angle, Vector3.up); Vector3 direction = rotation * Vector3.forward; Vector3 position = centerPos + (direction * radius); Instantiate(prefab, position, rotation); } }