Public API
Enemy Masses Public API Reference
This document provides a reference for the common public methods available in the Enemy Masses system. The primary entry point for most operations is the EnemyMassesCrowdController MonoBehaviour, which exposes a static Instance for convenience when you have a single controller in the scene.
Core Controller Access
Most operations are performed through the EnemyMassesCrowdController instance. The class sets a static Instance in Awake, but this is not a hard-enforced singleton—adding multiple controllers will cause the last one to overwrite the static reference. Recommended: keep exactly one controller in the scene and use the static accessor for convenience.
// Access the singleton instance
EnemyMassesCrowdController controller = EnemyMassesCrowdController.Instance;Spawning Agents
Methods for spawning agents into the world.
Spawn by Faction Index
/// <summary>
/// Spawns agents from a specific faction index.
/// </summary>
/// <param name="enemyCrowdIndex">Index of the faction in the EnemyCrowds list.</param>
/// <param name="spawnPosition">World position to spawn at.</param>
/// <param name="spawnRotation">Rotation of the spawn group.</param>
/// <param name="count">Number of agents to spawn.</param>
/// <param name="formation">Formation type (Circle, Square, etc.).</param>
/// <returns>List of spawned agent indices.</returns>
public List<int> SpawnEnemyCrowd(
int enemyCrowdIndex,
Vector3 spawnPosition,
Quaternion spawnRotation,
int count,
FormationType formation = FormationType.Random
)Spawn by Faction Name
Despawning & Killing Agents
Methods for removing agents from the world.
Kill/Despawn Single Agent
Clear All Agents
Navigation & Movement
Methods for controlling agent movement.
Set Global Destination
Set Faction Destination
Healing & Health
Methods for restoring health to agents.
Heal Single Agent
Heal Agents in Radius (AOE)
Status Effects
The Status Effect System allows applying buffs, debuffs, and crowd control effects.
Accessing the System
Apply Effect (Runtime)
Remove/Dispel Effects
Civil AI
Methods for toggling agents between Combat and Civil modes.
Enable Civil Mode
Disable Civil Mode
Spawn Civil Agent
Despawn Civil Agent
Other Important Methods
Get Active Agents
Global Damage Multipliers
Events
Last updated