Skip to content

Scripting API Reference

This section documents the public C# types you interact with when extending Massive Swarm System from code. It is curated — it covers the components and assets you actually script against, not every internal type. For Inspector setup and the no-code workflow, start with the Manual.

You may not need this

The system is built to run from the Inspector — drop in a SwarmManager, point a SwarmTarget at the player, and you have a working swarm. Most projects never touch the scripting API. Reach for it only when you want to spawn targets at runtime, read swarm state, or hook the swarm into your own combat code.

Quick reference in your IDE

Key types and members carry a short XML summary, so hovering them in Visual Studio or Rider shows a one-line description while you code. These pages have the full detail.

Components

  • SwarmManager — the central simulation owner: spawn, despawn, move, and read the swarm from code.
  • SwarmAgent — the per-agent runtime handle: knockback, hit flashes, and which slot a visual occupies.
  • SwarmTarget — mark a GameObject as something the swarm chases.
  • Combat Contracts — the interfaces (IDamageable, IDamageableWithContext, ITargetable) that wire swarm damage into your own scripts.

Configuration assets

SwarmSettings, SwarmAgentArchetype, SwarmBehaviorProfile, and SwarmMovementProfile are ScriptableObject assets. Their accessors are read-only — you author them in the Inspector and can't build or change one from code at runtime. From a script you do two things with them:

  • Pass an archetype or profile when spawning — see the TrySpawnAgent overloads on the SwarmManager page.
  • Swap which asset a reference points at, then spawn with it. The manager resolves each profile to a runtime index on first use (GetOrRegisterBehaviorProfileIndex / GetOrRegisterMovementProfileIndex).

For what every field does, use the setup pages: Swarm Settings, Agent Archetype, Movement Profile, and the Behaviors section.

More types are documented as the reference grows.