using UnityEngine;
using System.Collections;
public class spawning : MonoBehaviour {
public GameObject block1;
public GameObject block2;
public GameObject block3;
public GameObject block4;
public GameObject block5;
public GameObject block6;
public bool spawned;
public float chooser;
public float seconds;
void Start () {
chooser = Random.Range (1, 6);
seconds = Random.Range (1, 5);
}
void Update () {
spawnernumerator ();
}
IEnumerator spawnernumerator()
{
while (true) {
chooser = Random.Range (1, 6);
seconds = Random.Range (1, 5);
if (chooser == 1) {
Instantiate (block1, transform.position, Quaternion.identity);
}
if (chooser == 2) {
Instantiate (block2, transform.position, Quaternion.identity);
}
if (chooser == 3) {
Instantiate (block3, transform.position, Quaternion.identity);
}
if (chooser == 4) {
Instantiate (block4, transform.position, Quaternion.identity);
}
if (chooser == 5) {
Instantiate (block5, transform.position, Quaternion.identity);
}
if (chooser == 6) {
Instantiate (block6, transform.position, Quaternion.identity);
}
yield return new WaitForSeconds (seconds);
}
yield return new WaitForSeconds (seconds);
}
}
The problem is that values for chooser and seconds dont change and also gameojbects dont spawn , in inspector I put all gameobjects into slots .