Hi again you fine folks.
So I'm making a driving game and there is going to be some cows in the road you have to dodge.
Currently I've laid 3 spawnpoints in the form of flat cubes, with the following script attached to each of them. (The reason I am manually laying the spawn points out myself is that the road is very windy, and has steep hills etc , and I was struggling to find a way to prodecurally place them on the road exactly at correct height etc.
Here is the code im using for these spawn points. For some reason I am getting all 3 cows spawn on the first spawn point, instead of just one. I haven't driven the car thru to the other 2 spawn points, id guess there'd be 3 cows at each of them. (I have to actually build to my phone to get that far due to the controls being for mobile not PC):
public class CowSpawn : MonoBehaviour {
public GameObject bullPrefab;
public float spawnChance;
bool willSpawn = false;
private GameObject bull;
// Use this for initialization
void Start()
{
if (Random.value < spawnChance)
{
willSpawn = true;
}
bull = (GameObject)Instantiate(bullPrefab);
bull.transform.position = GetComponent<GameObject>().transform.position;
}
// Update is called once per frame
void Update () {
}
}