webhookPublic API

Enemy Masses Public API Reference

This document provides a comprehensive reference for the 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.


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 enemy crowd faction by 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, Random, etc.).</param>
/// <param name="formationSpacingOverride">Optional: Override the default formation spacing.</param>
/// <returns>List of spawned agent indices.</returns>
public List<int> SpawnEnemyCrowd(
    int enemyCrowdIndex, 
    Vector3 spawnPosition, 
    Quaternion spawnRotation, 
    int count, 
    FormationType formation = FormationType.Random,
    float? formationSpacingOverride = null
)

Spawn by Faction Index (Transform)

Spawn by Faction Name

Spawn by Faction Name (Transform)


Despawning & Killing Agents

Methods for removing agents from the world.

Kill/Despawn Single Agent

Kill by GPUICrowdInstance

Clear All Agents

Respawn Agent


Methods for controlling agent movement.

Set Global Destination

Set Faction Destination (by Index)

Set Faction Destination (by Name)

Set Destination for Spawn Group

Set Destination for Single Agent


Healing & Health

Methods for managing agent health.

Heal Single Agent

Heal by GPUICrowdInstance

Heal Agents in Radius (AOE)

Get Agent Health


Status Effects

The Status Effect System allows applying buffs, debuffs, and crowd control effects directly through the controller.

Apply Status Effect (Runtime)

Apply Status Effect (Config Asset)

Apply Status Effect in Radius (AOE)

Remove/Dispel Effects

Query Status Effects


Civil AI

Methods for toggling agents between Combat and Civil modes.

Enable Civil Mode

Disable Civil Mode

Spawn Civil Agent

Despawn Civil Agent

Civil Navigation Commands


Query Methods

Methods for retrieving agent information.

Get Active Agents

Get Agents in Radius

Get Agents by Owner (Networking)

Get Alive Agents

Get Agent by GameObject


Global Damage Multipliers

Properties for adjusting global damage values at runtime.

Example Usage


Events

Events fired by the controller for integration with other systems.

Core Events

Network Events

Event Usage Example


Subsystem Access

Methods to access underlying subsystems for advanced operations.


Faction Battle Mode

Properties for controlling faction vs faction battles.

Example


Quick Reference

Category
Method
Description

Spawning

SpawnEnemyCrowd()

Spawn by faction index

SpawnEnemyCrowdByName()

Spawn by faction name

Killing

KillAgent()

Kill single agent

ClearAllAgents()

Remove all agents

RespawnAgent()

Respawn dead agent

Navigation

SetDestination()

Move all agents

SetDestinationForFaction()

Move specific faction

SetDestinationForAgent()

Move single agent

Health

HealAgent()

Heal single agent

HealAgentsInRadius()

AOE heal

GetAgentHealth()

Query health

Status Effects

ApplyStatusEffect()

Apply buff/debuff

ApplyStatusEffectInRadius()

AOE status effect

DispelNegativeEffects()

Cleanse debuffs

DispelPositiveEffects()

Purge buffs

Civil AI

EnableAgentCivilMode()

Switch to civil

DisableAgentCivilMode()

Switch to combat

Queries

GetAgents()

Get all agents

GetAgentsInRadius()

Spatial query

GetAgentByGameObject()

Find by GameObject


Networking API Reference

This section covers the networking interfaces and classes for multiplayer integration.

Note: Enemy Masses provides networking groundwork (~70% complete). You implement the RPC layer using your preferred networking solution (NGO, Mirror, Photon, etc.).


NetworkAuthorityProvider

Static class for registering and accessing network authority implementations.


INetworkAuthorityProvider

Base interface for network authority. Implement this to integrate with your networking solution.


INetworkSpawnAuthority

Interface for server-authoritative spawning and despawning.


INetworkDamageAuthority

Interface for server-authoritative damage validation.


INetworkCommandAuthority

Interface for server-authoritative command validation.


INetworkAuthorityExtended

Extended interface that combines all sub-authorities.


AntiCheatComponent

Server-side anti-cheat system. See Anti-Cheat System for full documentation.


Command Data Structures

MoveCommandData

AttackCommandData

StopCommandData


Event Data Structures

SpawnEventData

DamageEventData

DeathEventData

HealthChangeEventData


Networking Enums

DespawnReason

DamageType

DamageRollbackReason

CommandRejectReason

CheatType

HealthChangeReason


Networking Quick Reference

Interface
Purpose

INetworkAuthorityProvider

Base interface - IsServer, IsClient, LocalPlayerId

INetworkSpawnAuthority

Spawn/despawn with network IDs

INetworkDamageAuthority

Damage validation and confirmation

INetworkCommandAuthority

Command validation and sync

INetworkAuthorityExtended

All-in-one extended interface

Class
Purpose

NetworkAuthorityProvider

Static accessor for registered authority

LocalNetworkAuthority

Single-player/testing stub

AntiCheatComponent

Server-side cheat detection

Data Structure
Purpose

MoveCommandData

Move command parameters

AttackCommandData

Attack command parameters

StopCommandData

Stop command parameters

SpawnEventData

Spawn event details

DamageEventData

Damage event details

DeathEventData

Death event details

HealthChangeEventData

Health change details

AntiCheatStatistics

Anti-cheat metrics


See Also

  • Networking Overview - Architecture and concepts

  • NGO Integration Guide - Netcode for GameObjects 2.7.0

  • Anti-Cheat System - Server-side protection

  • Local Network Authority - Testing without networking


RTS Controller API Reference

The EnemyMassesRTSController provides selection, commands, and formation controls for RTS gameplay.


Controller Access


Properties


Selection Methods

Clear Selection

Select Agents

Select Faction

External Selectables


Command Methods

Request Move Command (Networked)

Request Attack Command (Networked)

Request Stop Command (Networked)

Execute Server Commands


Combat Stance Methods


Events

Selection Events

Command Events

Network Command Events


SelectionChangedEventData


RTS Controller Quick Reference

Category
Method/Property
Description

Properties

SelectedAgents

Currently selected agent indices

SelectedCount

Number of selected agents

IsDragging

True during drag selection

Selection

ClearSelection()

Deselect all

SelectAgents()

Select by indices

SelectFaction()

Select all in faction

Commands

RequestMoveCommand()

Move with network support

RequestAttackCommand()

Attack with network support

RequestStopCommand()

Stop with network support

Server

ExecuteServerMoveCommand()

Apply server command

ExecuteServerAttackCommand()

Apply server attack

ExecuteServerStopCommand()

Apply server stop

Stance

SetSelectedAgentsCombatStance()

Set combat behavior

SetSelectedAgentsOffensive()

Aggressive mode

SetSelectedAgentsDefensive()

Reactive mode

SetSelectedAgentsHoldPosition()

Static defense


RTS Camera Controller API Reference

The RTSCameraController provides camera movement, zoom, rotation, and bookmarks for RTS gameplay.


Controller Access


Properties


Preset Methods

Apply Preset

Transition to Preset

Preset Management


Focus & Follow Methods


Bookmark Methods


Camera Control Methods


Direct Camera Manipulation


Events


Camera Controller Quick Reference

Category
Method/Property
Description

Properties

ActivePreset

Current camera preset

IsControlActive

Whether controls are active

CurrentPosition

Camera target position

CurrentZoom

Current zoom level

Presets

TransitionToPreset()

Smooth preset change

ApplyPreset()

Instant preset change

GetPresetAt()

Get preset by index

Focus

FocusOnPosition()

Move to position

FocusOnTarget()

Move to transform

StartFollowing()

Begin follow mode

StopFollowing()

End follow mode

Bookmarks

SaveBookmark()

Save camera state

LoadBookmark()

Restore camera state

Control

SetControlActive()

Enable/disable control

SetPosition()

Direct position set

SetZoom()

Direct zoom set

SetRotation()

Direct rotation set

Shake()

Camera shake effect

Last updated