hi all
like in the title i have to spawn my gameobject in random range coordinates, but i dunno how i can do that.
i wrote this script:
function spawn () {
spawnpos = Random.Range(1,4);
if (spawnpos == 1)
Instantiate(enemy1, Vector3(Random.Range(-10,10),-6,0));
if (spawnpos == 2)
Instantiate(enemy1, Vector3(-10,Random.Range(-6,6),0));
if (spawnpos == 3)
Instantiate(enemy1, Vector3(Random.Range(-10,10),6,0));
if (spawnpos == 4)
Instantiate(enemy1, Vector3(10,Random.Range(-6,6),0;));
}
but didn’t work…what i’m doing wrong? :
thank you all for your help!