using UnityEngine; using System.Collections; using System.Collections.Generic; [System.Serializable] public class SpawnEntry { public MonsterData monsterData; public Vector3 position; } public class MonsterSpawner : MonoBehaviour { public List spawnList; public Transform monsterParent; public void SpawnAll() { foreach (var entry in spawnList) { GameObject groupObject = new GameObject("MonsterGroup_" + entry.monsterData.monsterName); groupObject.transform.position = entry.position; groupObject.transform.parent = monsterParent; MonsterFormationGroup group = groupObject.AddComponent(); group.monsterData = entry.monsterData; group.anchorPosition = entry.position; group.Spawn(); // 👈 c'est là que tout se passe } } private void Start() { SpawnAll(); } }