Why do enemies pop in next to you?

Any random point in the arena is allowed.

Why do enemies pop in next to you?

The problem

Anywhere goes.

Vector3 PickSpawn(){    return arenaCenter + Random.insideUnitSphere * arenaRadius;}

Sometimes that's on the player, which feels unfair. It also ignores height.

The fix

Reject points too close.

Try again until the point is far enough, with a limit on tries.

distance≥minDistanceor retry

The fix in code

A fair spawn.

Vector3 PickSpawn(){    for ( int i = 0; i < 20; i++ )    {        Vector2 c = Random.insideUnitCircle * arenaRadius;        Vector3 p = arenaCenter + new Vector3( c.x, 0f, c.y );        if ( ( p - player.position ).sqrMagnitude >= minDist * minDist ) return p;    }    return farthestSpawnPoint;}

A circle keeps it on the ground. The fallback means it never loops forever.

Watch out

Better still.

Also skip points the player can see, so nothing pops in on camera.

Too close
reject
In view
reject
Off the mesh
SamplePosition

The rule

Spawn away from players.

Reject
inside minDist
Limit
the retries
Fallback
a safe point