var spawnObject = spawner.AddComponent<CombatantSpawner>();
spawnObject.useNearestArena = true;
spawnObject.battleType = BattleSystemType.TurnBased;
spawnObject.arenaRange = 100000f;
spawnObject.spawnRandom = true;
spawnObject.autoStartAfter = 1f;
spawnObject.startType = EventStartType.Autostart;
spawnObject.combatant = new BattleCombatant[MobGroups.Count];
for (int combatantIndex = 0; combatantIndex < MobGroups.Count; combatantIndex++) {
var battleCombatant = new BattleCombatant {
factionID = 1,
useGroup = true,
id = MobGroups[combatantIndex].RealID
};
spawnObject.combatant[combatantIndex] = battleCombatant;
}
spawnObject.spawnerID = Guid.NewGuid().ToString();
It looks like you're new here. If you want to get involved, click one of these buttons!
Your spawners aren't all spawning, because by default the scene ID will be used - once it's set, other spawners with the same ID will not spawn (and by default, the ID is 0 if you add them via script).
You should either set a unique scene ID, or disable using the scene ID, e.g.:
spawnObject.useSceneID = false;
Generally, I'd not advise doing that by code. It's better to use prefabs with already set up spawners for that.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I'll try to use prefabs instead of scripts.