Spawning enemies using insideUnitCircle :

I’m trying to create a prefab, that I can place anywhere on a map (2D top down shooter) using insideUnitCircle to randomise the spawns somewhat but keeping them inside a general area and not outside of map boundaries.
Here is my script so far:

public class SpawnCircle : MonoBehaviour {

public GameObject enemyType;
public int enemyCount;
public float spawnDelay;
public float spawnRate;
public float spawnRadius;
private int counter;
	
// Use this for initialization
void Start (){
	counter = 0;

	
	
}
void OnTriggerEnter2D(Collider2D other) {
	if (other.gameObject.tag == "Player") {
		Destroy (GetComponent<Collider2D> ());
		InvokeRepeating ("Spawn", spawnDelay, spawnRate);
	}

	
}
void Spawn() {
							
	Instantiate(enemyType, transform.position = Random.insideUnitCircle * spawnRadius, transform.rotation);
	counter = counter + 1;
	if (counter == enemyCount)
		Destroy (this.gameObject);
	
}

}
Unfortunately this will place the centre of the spawn area at map co-ordinates 0,0.

How can i move the centre of the circle to where i have placed my prefab?
Any help would be much appreciated.

Add the random position to the SpawnCircle’s current position

Instantiate(enemyType, transform.position + (Random.insideUnitCircle * spawnRadius), transform.rotation);

What you previously had inside the Instantiate() call

transform.position = Random.insideUnitCircle * spawnRadius

was setting the SpawnCircle’s position to a random spot around 0,0 and spawning the item in that same place.

Ok, after a little research i found this:

and changed my code to:

	newPosition = Random.insideUnitCircle * spawnRadius;
	newPosition.x += transform.position.x;
	newPosition.y += transform.position.y;
							
	Instantiate (enemyType, transform.position = newPosition, transform.rotation);
	newPosition.x = 0;
	newPosition.y = 0;

(I needed to reset newPosition each time so the spawnpoint won’t wander all over the map)