I'm wondering how to make specific random objects drop. In my case, from the top of the screen.
I have 16 objects, named recycle_items_0
through recycle_items_15
.
IEnumerator CreateRoutine()
{
while (true)
{
yield return new WaitForSeconds(3);
CreateItems0();
}
}
private void CreateItems0()
{
Vector3 pos = Camera.main.ViewportToWorldPoint(new Vector3(UnityEngine.Random.Range(0.0f,1.0f),1.1f,0));
pos.z = 0.0f;
Instantiate(recycle_items_0, pos, Quaternion.identity);
}