Объекты
Добавлено: 26 сен 2020, 00:32
Здравствуйте,что делать у меня показывает что объекты спавнятся на кординате z 0,но все равно один выше,другой ниже.Что делать?
using UnityEngine;
using System.Collections;
public class SpawnMeteors : MonoBehaviour {
public GameObject[] meteors;
private float[] positions = { -1.5f, -0.72f, 0, 0.72f, 1.5f };
void Start() {
StartCoroutine(spawn());
}
IEnumerator spawn() {
while (true) {
Instantiate(
meteors[Random.Range(0, meteors.Length)],
new Vector3(positions[Random.Range(0, 5)], 6f, 0),
Quaternion.Euler(new Vector3(0, 0, 0))
);
yield return new WaitForSeconds(1.5f);
}
}
}
using UnityEngine;
using System.Collections;
public class SpawnMeteors : MonoBehaviour {
public GameObject[] meteors;
private float[] positions = { -1.5f, -0.72f, 0, 0.72f, 1.5f };
void Start() {
StartCoroutine(spawn());
}
IEnumerator spawn() {
while (true) {
Instantiate(
meteors[Random.Range(0, meteors.Length)],
new Vector3(positions[Random.Range(0, 5)], 6f, 0),
Quaternion.Euler(new Vector3(0, 0, 0))
);
yield return new WaitForSeconds(1.5f);
}
}
}