Hello. I am trying to make a script where there are multiple possible object variants to spawn (in this case enemy types) and the it randomly spawns a set number of them at repeating intervals, but when I try my script I get the error " No appropriate version of 'UnityEngine.Random.Range' for the argument list '(UnityEngine.GameObject, UnityEngine.GameObject, UnityEngine.GameObject)' was found."
How can I fix my script? Thanks :)
var A : GameObject;
var B : GameObject;
var C : GameObject;
if (Projectile.Defeat < 200 && Projectile.Defeat > 80)
{ yield WaitForSeconds(5.0);
Instantiate(Random.Range(A,B,C), position, Quaternion.identity);
}
EDIT For being organized, is there a better way to instantiate multiple objects other than copying the instantiate part of the script like this?
Instantiate(objs[(Random.Range(0, 3))], new Vector3(Random.Range(481.5735, 559.3441), -791.811, Random.Range(380.1254, 420.0663)), Quaternion.identity);
Instantiate(objs[(Random.Range(0, 3))], new Vector3(Random.Range(481.5735, 559.3441), -791.811, Random.Range(380.1254, 420.0663)), Quaternion.identity);
Instantiate(objs[(Random.Range(0, 3))], new Vector3(Random.Range(481.5735, 559.3441), -791.811, Random.Range(380.1254, 420.0663)), Quaternion.identity);