28 lines
695 B
C#
28 lines
695 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlaceObjectsInCircle : MonoBehaviour
|
|
{
|
|
public float Distance;
|
|
|
|
|
|
[ContextMenu("Place")]
|
|
public void Place()
|
|
{
|
|
List<Transform> children = new List<Transform>();
|
|
|
|
for (int i = 0; i < transform.childCount; i++)
|
|
{
|
|
children.Add(transform.GetChild(i));
|
|
|
|
}
|
|
|
|
for (int i = 0; i < children.Count; i++)
|
|
{
|
|
children[i].transform.rotation = Quaternion.Euler(new Vector3(-90, i * (360f / children.Count), 0));
|
|
children[i].transform.localPosition = Vector3.zero + children[i].transform.up * Distance;
|
|
}
|
|
}
|
|
}
|