My game characters keep spawning at one position and they get squashed together i want them to spawn one after another from the door of the shop and after they recieve their product they leave from the door again This is a picture of how they look when they spawn since i'm putting them in a group spawn:
This is the script i'm using to spawn them:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterSpawn : MonoBehaviour
{
[SerializeField]
private float spawnRadius = 7, time = 1.5f;
public GameObject[] enemies;
public Transform groupTransform;
void Start()
{
StartCoroutine(SpawnAnEnemy());
}
IEnumerator SpawnAnEnemy()
{
Vector2 spawnPos = GameObject.Find("Bengal").transform.position;
Instantiate(enemies[Random.Range(0, enemies.Length)], spawnPos, Quaternion.identity, groupTransform);
yield return new WaitForSeconds(time);
StartCoroutine(SpawnAnEnemy());
}
}
EDIT: They still spawn together even after trying the solution bellow check this picture:


