IEnumerator QueueTime(GameObject car, float WaitTime) { isSpawning = true; yield return(new WaitForSecondsRealtime(WaitTime)); objects.Dequeue(); if (car == objectSpawn.object1_Prefab) { objectSpawn.objectSpawn1(); } else if (car == objectSpawn.object2_Prefab) { objectSpawn.objectSpawn2(); } else if (car == objectSpawn.object3_Prefab) { objectSpawn.objectSpawn3(); } isSpawning = false; }