Wave Spawner | Instaniating Enemys will Overlap

I am creating a wave Spawner with SpawnPositions but sometimes the Enemies will Overlap…

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpawnController : MonoBehaviour {

    public Transform[] spawnPos;
    public GameObject enemyPrefab;
    public float timeBetweenWaves = 1f;
    public float timeToSpawn;
    public int enemysEachWave;
    GameObject clone;

	void Start () {
        Spawn();
	}
	

	void Update () {
		if(Time.time >= timeToSpawn)
        {
            Spawn();
            timeToSpawn = Time.time + timeBetweenWaves;
        }
	}

    void Spawn()
    {
        for (int i = 0; i < enemysEachWave; i++)
        {
            clone = Instantiate(enemyPrefab, spawnPos[Random.Range(0, spawnPos.Length)].position, Quaternion.identity);
        }
    }
}

To avoid spawning enemies at the same position within a wave you need 1) at least as many spawn positions as enemies 2) only use each spawning positions once.

The first needs to be set up by you.

For the second, either shuffle the array of spawning positions, or you create a list of the positions and remove a position every time it is used (no worries, the original array remains. See below the second approach:

using System.Collections.Generic; // add this to the top

void Spawn () {
     List<Transform> unusedSpawnPositions = new List<Transform>();
     unusedSpawnPositions.AddRange(spawnPos); // add the positions defined to the list
     for (int i = 0; i < enemysEachWave; ++i) {
          if (unusedSpawnPositions.Count < 1) { break; } // protect against empty list
          int spawnPosIndex = Random.Range(0, unusedSpawnPositions.Count); // select index of spawn position
          clone = Instantiate(enemyPrefab, unusedSpawnPositions[spawnPosIndex];
          unusedSpawnPositions.RemoveAt(spawnPosIndex); // remove spawn position
     }
}

So i have thought abou this issue with a project i was working on awhile back and what i was thinking about doing was this.
Create a dummy game object in the scene with a collider the same size as the enemy. Reference the empty game object on the wave spawner.
When the wave spawner wants to spawn an enemy , have it move the dummy object to the point and if it hits collision randomize the location again. Then set the dummy to Setactive(false) and do the process again
.

pseudo code 

  dummyObject = DO
  wave spawner wants to spawn. 
  DO is moved into that position
  DO is setactive(true)
  if DO has collision
       wave spawner gets a new position 
       DO is moved to that new position
  if no collision
       spawn the enemy.

It seems to me that you did not add any script to your enemyPrefab which would put the instance of this prefab into motion. It can be also that the script does exist but is not enabled. Or some public variables (like speed) are not assigned in the inspector. It’s hard to say, but try to attach this simple script to your enemyPrefab. If clones start moving that means you have the solution:

using UnityEngine;

public class Enemy : MonoBehaviour
{
	public float speed = 3f;
		
	private void Update()
	{
		transform.position += Time.deltaTime * speed * transform.forward;
	}
}