Swarm Perception Profile¶
A Perception Profile is what turns "always knows where the target is" into "only reacts to what it has actually noticed." Assign one to an archetype and its agents start out blind: they have to spot a target with Sight, or be told about one through a stimulus, before they will chase it at all. Leave the slot empty and an archetype behaves exactly the way every archetype did before this system existed: it always knows where its target is.
That single switch is the whole point of the asset. Everything else on it, Sight, Awareness, Following The Crowd, Searching, Alert Spread, only decides the details of how an already-perception-gated archetype notices, remembers, and reacts once it has lost contact.
Where to find it, and what it needs to do anything
Create one with right-click in the Project window → Create → Massive Swarm System → Agents → Perception Profile, then drop it into the Perception Profile slot on your archetype. It is a separate asset from the Behavior Profile, and it has no Simple or Advanced mode: every section is always visible.
Sight and Awareness work on their own the moment a profile is assigned. Alert Spread sends its calls on its own too, but a call only tells a neighbour that a target exists, and the neighbour moves only if Searching or Following The Crowd is on. Those two are different: both are steering, and the steering runs inside the Approach & Press pass on the archetype's Behavior Profile. Disable Approach & Press there and an archetype still notices and forgets targets underneath, but nothing steers off what it noticed.
The five sections¶
| Section | Decides |
|---|---|
| Sight | How far, how wide, and through what an agent notices a target in the first place |
| Awareness | How long it takes to commit once something is detected, and how long it keeps believing once detection stops |
| Following The Crowd | Whether an agent that loses contact copies the heading of a nearby agent that still has it |
| Searching | Whether an agent that loses contact and finds nobody informed nearby walks to the spot it last had the target |
| Alert Spread | Whether an agent that spots a target by itself calls the agents around it |
Following The Crowd and Searching form a ladder, tried in that order, for an agent that has lost contact. A neighbour who can see the target right now beats this agent's own memory of where it was, so Following The Crowd goes first. With both off, a lost agent gets no steering from either rung and mills where it stands until Forget Time lets the target go, at which point Idle Motion is what is left doing anything.
Practical Usage Guidance¶
Reach for a Perception Profile the moment a level has walls, rooms, or corners the player can use, or the moment the design wants stealth, ambush, or "did it see me" to mean anything. It is also what lets a spawn point sit genuinely dormant until an ally's Alert Spread call, or a scripted EmitStimulus, wakes it, rather than tracking the player from the moment it spawns.
Skip it for a default open-arena horde where every enemy should always know exactly where the player is. An archetype with no Perception Profile already does that for free. Assigning one with a huge Range, a full circle Field Of View and Occlusion off only reproduces the same behavior at the cost of running Sight every step for every agent, with none of the recovery ladder ever engaging.
Sight runs every step, with no Reduced or Cheap throttle
The Range test runs every simulation step for every agent carrying a Perception Profile, whatever Importance LOD tier that agent is in. An agent beyond Range of the box around all active targets skips the rest of the sight loop, and a committed agent re-runs the wall test only every few steps (see Sight). The steering the ladder produces is throttled the same way Approach & Press is, but the sensing underneath it is not. Assigning a Perception Profile to a very large archetype population is a cost decision on its own, independent of which sections you turn on.
Gameplay Interpretation¶
A crowd built entirely from unprofiled archetypes reads as relentless: every agent already knows exactly where you are, all the time. Handing an archetype a Perception Profile is what makes losing it, sneaking past it, or being spotted by it into something that can actually happen. How forgiving or how sharp that read feels is mostly Awareness's job; how far it can be tricked into looking the wrong way is Sight's.
Quickstart: setting up a profile for the first time
- Assign the profile to the archetype, then turn on Approach & Press on its Behavior Profile if it is not already, since the recovery ladder lives there.
- Tune Sight first: Range, Field Of View and Occlusion decide whether this archetype can be sneaked past at all.
- Tune Awareness next to set the reaction lag and how long a chase survives losing contact.
- Turn on Following The Crowd and Searching for archetypes that should visibly hunt rather than give up the instant contact breaks.
- Add Alert Spread last, once a single agent noticing correctly reads the way you want.
Making a noise: the Swarm Noise Emitter¶
A profile decides what an agent notices by itself. Swarm Noise Emitter works the other way round: it goes off somewhere in the level and tells the agents near it that something happened. A gunshot, a car alarm, a bottle thrown down an alley. Only agents carrying a Perception Profile hear anything, so a scene with no profile in it is left alone.
Add one with Add Component → Massive Swarm System → Swarm Noise Emitter, or skip the component and call SwarmManager.EmitStimulus from your own code.
| Field | Default | What it does |
|---|---|---|
| Radius | 25 | How far the noise carries, in units |
| Strength | 1 | How convinced whoever hears it becomes, 0 to 1. Below 1 they give up sooner, since awareness fades at Forget Time from wherever it starts |
| Wall Occlusion | None | Whether walls ignore this noise, quieten it, or stop it |
| Attract To | empty | The registered Swarm Target the noise points at. Left empty it takes the nearest Swarm Target above it in the hierarchy, and with none there the noise is about its own spot. It has to be the object that carries the Swarm Target component, not a child of it |
| Trigger | Manual | Manual waits for Emit, which any UnityEvent or Animation Event can call. On Enable fires once, for a prop spawned to make a single noise. Repeating keeps going while the component is enabled |
| Repeat Every | 3 | Seconds between noises while the trigger is Repeating |
| Emit At Most Every | 0.25 | Shortest gap between two noises, whoever asks. A weapon on a held trigger does not need one query per shot, because the second noise reaches the agents the first one already woke |
A noise needs Searching on to move anybody
A noise with a target behind it (a gunshot on a weapon carried by the player points at the player) tells agents about that target, and they walk to where the noise went off. That walk needs Searching on. With it off, an agent that hears the noise moves only if Following The Crowd is on and a neighbour can see the target. A noise with no target is about its own spot: an agent that has nothing it sees or remembers walks to where the noise went off and forgets it after its Forget Time. That is how a thrown bottle or an alarm works, with Attract To empty and no Swarm Target above the emitter.
A noise with no target only moves an agent whose Perception Profile has Searching on. With Searching off, it reaches the agent and moves nobody. An agent that already knows a target keeps it, and the noise waits until that target is forgotten.
What walls do to a noise¶
Wall Occlusion picks one of three, and the default keeps walls out of it.
- None (heard through walls): everything inside Radius hears it at full Strength. What a gunshot should do, since it is loud enough to go through a wall.
- Navigation Path (quieter around corners): Radius is how far the noise travels, and the way round to a listener is part of that journey. Somebody standing close still hears it round a long corner, somebody already at the edge of Radius loses it to a short one, and a room with no way into it hears nothing. A weakened noise also wears off sooner, because Forget Time fades it from where it started rather than from 1.
- Navigation Path (stops at walls): a wall stops the noise where it stops an Alert Spread call, so the two ways of making a sound give one answer about what a wall does.
Both wall settings need a baked Surface Flow Field
They read the navigation data Sight reads for its own Occlusion, so the scene needs Surface Flow Navigation turned on with its quality at Smooth or Eikonal. Cardinal keeps arrows and no cost field, so it has nothing to answer with. When there is nothing to read the noise carries as though no wall were there rather than going quiet, which is the same direction Sight fails in. The emitter's inspector checks the Swarm Manager in the open scene and says which of the two is missing.
It reads the field baked toward whatever Attract To points at, so a target the manager is not currently tracking leaves the test with nothing to measure against and the noise carries. A noise with no target at all has no field to read, so it always carries through walls, whichever Wall Occlusion is picked.
Setting a noise off from code¶
Emit() makes the noise where the component sits. It returns nothing on purpose, so a UnityEvent
or an Animation Event can call it straight from the inspector.
EmitAt(Vector3 origin) makes it somewhere else, for a muzzle, an impact point, or a bottle that
landed away from the object holding the emitter. It returns how many agents heard it.
using MassiveSwarmSystem.Runtime.Perception;
[SerializeField] private SwarmNoiseEmitter m_gunshot;
private void OnShotFired(Vector3 muzzlePosition)
{
int heard = m_gunshot.EmitAt(muzzlePosition);
}
A return of 0 means nobody heard it, and there are several ways to get one: no Swarm Manager in the
scene or one that has not finished initializing, no agent in the scene carrying a Perception
Profile, Radius at 0, Strength at 0, or Emit At Most Every refusing the call because the last
noise was too recent. LastReachedCount holds the same number until the next call, for code that
used Emit() and still wants the count.
Try it without leaving the editor
In Play mode the emitter's inspector reads Last noise reached N agents and carries an Emit Now button beside it. A noise is invisible and instant, so setting one off by hand and watching who turns is the quickest way to find out whether Attract To and Radius are doing what you meant. The button appears for a single selected emitter.