public GameObject[] obj;
private GameObject installed_object;
private int rand=0;
public int spawnTime=50;
private float TimeToDeploy=1;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (TimeToDeploy >= 150)
{
rand = Random.Range(0, obj.Length - 1);
installed_object = Instantiate(obj[rand], obj[rand].transform.position, Quaternion.identity) as GameObject;
installed_object.transform.localPosition = new Vector3(0, 3.2f, 36);
TimeToDeploy -= 150;
}
else
TimeToDeploy += Time.deltaTime*spawnTime;
}
Ошибка вот тут:
installed_object = Instantiate(obj[rand], obj[rand].transform.position, Quaternion.identity) as GameObject;
Идей вообще нет. Пробовал сам что-либо сделать. По итогу - ничего)