Random place spawning? how does i do it?

For a game I’m making I’m trying to get the enemies to spawn randomly in a certain area but I dont know how. Since I need a clear space where they wont spawn inside the spawning spot I’m thinking of puting 2 spheres without colliders or renderers to mark the area but then my major problem is making sure they spawn on the ground, or even a bit above it.

You can use Random.insideUnitCircle to generate a circle, or Random.Range to generate inside a square.

Inside circle:

var v3 = Random.insideUnitCircle * radius;
v3.z = v3.y;
v3.y = groundLevel;
v3 = v3 + centerPosition;

Inside a rectangle:

var v3 = Vector3(Random.Range(minX, maxX), groundLevel, Randome.Range(minZ, maxZ));

[8604-random.unitypackage.zip|8604]