Hello, guys! I have this script I’m working on. How can I make this both then-statements equally possible and randomly execute, but not at ONE time (like it does now)?
void Update ()
{
if (timer > maxTime)
{
// first spawning object
GameObject newwall = Instantiate(wall);
newwall.transform.position = transform.position + new Vector3(0, Random.Range(-height, height), 0);
Destroy(newwall, 15);
timer = 0;
// second spawning object
GameObject newmetal = Instantiate(metal);
newmetal.transform.position = transform.position + new Vector3(0, Random.Range(-height, height), 0);
Destroy(newmetal, 15);
timer = 0;
}
timer += Time.deltaTime;
}
Help me not to reinvent the wheel! Thank you!