I want my random.range script choose between 1 or 2 position not 1 to 2 positions, how to do it? Can i do it with Random.Range?
Here’s my script, it’s working but not the way i want.
using UnityEngine;
using System.Collections;
public class ObstacleSpawnScript : MonoBehaviour {
public GameObject Car1;
public Vector3 spawnLocation;
// Use this for initialization
void Start () {
StartCoroutine (ObstacleSpawn ());
}
IEnumerator ObstacleSpawn(){
while (true) {
spawnLocation = new Vector3(10, -0.5f, Random.Range(-1.55f, 1.55f));
Instantiate(Car1, spawnLocation, Quaternion.identity);
yield return new WaitForSeconds(4f);
}
}
}