using UnityEngine; public class Spawner : MonoBehaviour { public GameObject[] cube; public Transform[] point; public float beat = 1; float timer = 0f; void Start() { } // Update is called once per frame void Update() { if(timer > beat) { int c = Random.Range(0, 2); int p = Random.Range(0, 4); GameObject obj = Instantiate(cube[c], point[p]); //beatBox를 랜덤하게 생성 obj.transform.localPosition = Vector3.zero; //박스의 벡터(방향을 초기화) obj.transform.Rotate(transform.forward, 90 * Random.Range(0, 4)); //박스의 회전(방향, 회전률) timer -= beat; } timer += Time.deltaTime; } }