Skip to content

Breakable Obstacles

A breakable obstacle is a Swarm Flow Modifier with a finite Route Cost and a way to take damage, almost always a Swarm Breakable. The horde can always eventually get through one of these: if going around is ever more expensive than crossing it, the crowd commits, and enough strikes or enough weight brings it down.

An impassable obstacle is anything with Route set to Blocked, or a wall baked into the map itself. Nothing the swarm does opens either of those. Blocked is for the wall that should never come down; reach for Extra Cost the moment you want the horde able to fight its way through, even if that takes a very long time.

This page covers the mechanics layered on top of the fields Doors and Barricades lists: how agents decide to press and hit something, what strikes and crowd pressure each do, how noise draws a crowd without letting a siege feed itself forever, and four setups you can copy.

How Agents Decide to Press and Hit

An agent batters an obstacle only when it is actually going somewhere and that obstacle blocks the way. "Going somewhere" means one of three things, and only the first one needs any setup at all:

  • Its live target. Every archetype with no Perception Profile behaves this way by default: it always knows where its target is, so any closed cell between it and that target counts.
  • The spot where it last saw a target, once Searching is on and contact is lost. The agent is still walking there, so it still presses whatever stands in the way.
  • A noise it heard, once a Perception Profile is assigned with Search on, and it has no target of its own. A hit or a break makes exactly this kind of noise; see below.

An agent with nowhere to go, such as one idling with no target, leaves an obstacle alone even when it is standing right against it.

Pressing is measured one unit ahead, not in a radius

An agent presses an obstacle when a closed cell sits within one unit (or one cell, if cells are larger) of where it is walking, along the direction it is heading, not inside a circle drawn around the door. That catches an agent closing in on the door before it actually touches it, while an agent walking past on its way somewhere else never counts just for passing near it.

A live target always wins over an obstacle. If a player is standing in the doorway and in reach, the swing lands on the player, not the door. The door only gets hit once the target cannot be reached that way, which for most of the crowd queued behind the front rank is most of the time.

Strikes and Crowd Pressure

Two separate things wear a breakable down, and they add up rather than compete.

Strikes come from whichever agents are actually touching the closed cell, using their normal Swing or Contact attack from their Attack Profile. Damage is the usual swing or contact damage, multiplied twice: once by that attack profile's Obstacle Damage Scale (1 hits it as hard as a target, 2 makes a brute that chews through doors fast, 0 means that archetype never swings at an obstacle at all), and once by the Swarm Breakable's own Strike Damage Scale (1 takes the full hit, 0 means nobody's hits land here at all, whatever archetype is attacking). Either multiplier at 0 means an agent that would have swung just presses instead.

Crowd pressure comes from every agent whose way there is closed just ahead of it, which is the agents bunched against the door, not the whole crowd stacked up behind them. Each pressing agent takes a steady Crowd Pressure Per Agent off its health every second. How many press at once depends on how many agents fit against the door, so it grows with the width of the opening and not with the queue behind it. The Swarm Breakable's live panel shows the count as Agents Pressing It. 0 turns this off and leaves only strikes. Neither Obstacle Damage Scale nor Strike Damage Scale touches this channel.

Both channels need agents to be stopped at the object in the first place. That takes Surface Flow Field Navigation on the SwarmManager, Surface Flow Enforce Cell Boundaries in Swarm Settings, and Blocks Agents and Agents Attack It on the modifier. With any of them off the object takes no damage from the swarm. The Swarm Breakable inspector checks all four and shows the first one that is off, with the button that turns it on.

Two scales, two different jobs

Obstacle Damage Scale lives on the Attack Profile, so it governs every obstacle that archetype can reach: use it to make a brute that chews through doors and a crawler that cannot, archetype by archetype. Strike Damage Scale lives on the object's own Swarm Breakable, so it is the one to reach for when a single door or fence should take hits differently from every other one an archetype might meet elsewhere. Turning off Agents Attack It instead of either is not a substitute: that field stops crowd pressure too, because pressure reads the same IDamageable that strikes do.

Damaged: the Route Gets Cheaper Once

Damaged Below sets the health fraction at or below which the object counts as Damaged instead of Intact. The moment it crosses that line, its effective Route Cost drops to Damaged Route Cost Scale times the full cost, by default half, and On State Changed fires.

That change happens exactly once per state, not continuously as health drops hit by hit. A door taking a beating restamps and rebakes maybe twice in its whole life, once at Damaged and once at Broken, instead of on every point of damage, which keeps a siege affordable with hundreds of agents watching that route.

The gameplay effect is the one described in How the Crowd Decides: once a door gives a little, it gets cheaper than the detour the crowd was using, and agents who were calmly filing through a side entrance redirect onto the door that is already failing.

Drawing a Crowd: Hit Noise and Break Noise

A breakable can call for backup. While it is taking damage, it makes a noise at most once every Hit Noise Interval, heard out to Hit Noise Radius by any agent whose Perception Profile has Search on and that has no target of its own. When the swarm's strikes or crowd pressure break it, it makes one more noise at Break Noise Radius. A break from Break(), the inspector's Break button or a player's shot is silent. In a scene where no archetype has a Perception Profile nobody can hear either noise, so both radius fields do nothing there.

Both noises are heard through walls, the way a Swarm Noise Emitter set to its "heard through walls" option would be: the whole point is to reach agents on the swarm's own side of the obstacle. There is no Strength field to make a hit or a break quieter than full; 0 on either radius is how you keep it silent instead.

A noise-only crowd cannot keep its own siege going

A hit only makes noise when it, or the crowd pressure that landed in that window, came from an agent that currently sees the target or remembers where it saw it. An agent that showed up only because it heard an earlier noise does not count, so once nobody left at the door has ever actually seen the target, the hits stop calling for more help. The crowd that is already there keeps battering until Forget Time runs out on whoever is still informed, and the siege runs down on its own instead of feeding itself forever.

A break the swarm causes always makes its noise, even pure crowd pressure with nobody informed left pressing. That noise points a new crowd at the opening rather than restarting the same fight: by the time anyone arrives the object is already broken and open, so there is nothing left there to press.

What's Left When It Breaks: Show On Break and Hide On Break

Breaking a Swarm Flow Modifier through a Swarm Breakable always means the same thing underneath: the modifier switches off, so the route stops avoiding it and agents walk straight through. What the player sees happen is entirely up to Hide On Break and Show On Break.

Hide On Break makes objects disappear, typically the door leaf. Show On Break does the opposite: it switches objects on, and back off again if you call Repair(). While the breakable is intact they stay off: it switches them off when it starts, even if they were left active in the scene, and switches its Hide On Break objects on. A shown object can carry its own Swarm Flow Modifier, which is how a break gets some texture instead of leaving open ground:

  • Rubble with Blocks Agents off and a small Extra Cost makes the gap a little slower to cross than open ground, without blocking it.
  • A boarded window shows the window's own modifier underneath the barricade that was covering it, so what the break leaves behind is the window, not a hole in the wall.

Disable Colliders On Break leaves the colliders of anything listed in Show On Break alone, so the rubble a break just revealed does not get switched off by that same break. The modifier overlap warning in the inspector knows about this pairing too: a child modifier listed in its parent's Show On Break never counts as an overlap, because the two are never active at the same time.

Leave Agents Attack It off on anything shown only once its parent is already broken. There is nothing left there to hit by the time it appears, so the setting does nothing except invite the editor's warning.

Opening and Shutting: IsOpen Is Always Your Call

IsOpen is a runtime switch, not something you set once in the inspector: your own door script sets it. true removes the modifier's closure and its route cost while it stays registered, so flipping it skips the unregister and re-register that disabling the component does. A Swarm Breakable switches the modifier off when it breaks and back on at Repair(), so a door script that also toggles enabled has to work around the breakable. IsOpen leaves enabled to it. It is not saved, so every door starts shut.

The swarm never opens or shuts anything by itself. That decision, and when it happens, belongs entirely to your own script: a trigger volume, a button prompt, a timer, a switch somewhere else in the level.

Closing on a crowd is already safe. Containment nudges any agent caught inside the frame back out toward the side it just came from, a step at a time, never through a wall, so a door shutting mid-crowd never traps or crushes anyone.

What your script does about a crowd standing in the doorway before it closes is your choice. The core only hands you SwarmManager.IsAnyAgentInside(modifier), which checks whether any agent's body currently overlaps the box; build the policy you want on top of it:

  • Wait: hold off closing until IsAnyAgentInside reports false. The natural choice for a door nobody is directly controlling, like the shipped DemoDoor.
  • Cancel: refuse to close at all while someone is inside, and raise your own event for a jammed sound or a blocked animation instead. Reach for this on a door the player operates: it never closes on, or ejects, someone mid-stride.
  • CloseAnyway: close regardless and let containment do the ejecting.

These three names describe a pattern for your own door script, not a dropdown in the inspector. Pick whichever fits the door, and mix them in the same scene: an automatic door can Wait while a player-operated one Cancels.

Four Worked Setups

A Player Door

Size a Swarm Flow Modifier to the doorway opening, Blocks Agents on, Route set to Extra Cost. Add a Swarm Breakable with however much health should stand between the horde and whatever is behind it. Your door script flips IsOpen on a trigger or a button, and Cancels rather than closes if someone is still in the frame while it is player-operated.

A Boarded Window

The boards are the obstacle the crowd actually fights: a Swarm Flow Modifier sized to the window, Blocks Agents and Agents Attack It on, and a Swarm Breakable whose health pool represents the boards, not the window. The window underneath gets its own Swarm Flow Modifier: Blocks Agents off, a small Extra Cost for the climb through, and no breakable of its own since there is nothing left to hit once the boards are down. List the window object under the boards' Show On Break, so it only appears once the boards do, and leave the boards' Hide On Break to whatever boards-coming-off visual you build.

A Wire Fence

Give it a high Max Health, leave Agents Attack It on so crowd pressure keeps working, and set its own Strike Damage Scale to 0. Nobody's hits land on it any more, whatever archetype is pressing, and only the crowd's weight wears it down. Obstacle Damage Scale stays free for its usual job elsewhere: telling a brute from a crawler on every other obstacle in the level. A fence like this suits a low Crowd Pressure Per Agent and a long Hit Noise Interval: it should read as something that gives way to numbers, not to any one hit.

Zeroing both channels makes it unbreakable by the swarm

Turn Strike Damage Scale down to 0 for this recipe, but leave Crowd Pressure Per Agent above 0. Zero both and the swarm can never bring it down at all, only Break() from your own code can, and the inspector catches the combination with a warning and a one-click fix for each field.

Swarm Breakable inspector warning: Strike Damage Scale and Crowd Pressure Per Agent are both 0, with Set Strike Damage Scale to 1 and Set Crowd Pressure to 1 buttons

Both channels at 0 on a Wire Fence object. Either button restores one of the two to a working value.

A Turret Placeholder

A placed turret is just another breakable obstacle today: a Swarm Flow Modifier sized by hand to approximate its base, Blocks Agents on, Route Extra Cost high enough that the horde avoids it until the turret genuinely is the shortest way through, and a Swarm Breakable with enough health to survive more than a stray hit. Matching the box to the turret's own collider shape automatically is not available yet; until then, a box close enough to its footprint is the whole setup.

Watching a Siege in Swarm Debug

Select an agent in the Swarm Debug window during Play mode and its Doors & Barricades block says what that agent is doing about the obstacle in front of it.

Doors and Barricades block of the Swarm Debug window: Way Blocked By Outer South Door, Agents Pressing It 5, Hit Noises 9, State Damaged at 42% health, Shoved By A Moving Prop No, Pressed Against Outer South Door, Doing Hitting it, Route Cost 5 units

An agent hitting a Zombie City door that is already Damaged, with five agents pressing it.

Way Blocked By is the obstacle closing the agent's way just ahead of it, and Agents Pressing It is how many agents pressed that obstacle on the last step, which is the number crowd pressure is charged on. Pressed Against is the obstacle the agent is stopped at, and Doing says whether it is hitting it, pushing it or only stopped by it.

Read these first when a door will not break. If Way Blocked By says Nothing for an agent standing at the door, it has no goal to press toward, usually because it forgot what it was after. This block never shows a pressing count of 0. The Swarm Breakable's own live panel shows Agents Pressing at 0. A siege ends once Forget Time has passed since the last hit noise.

Quickstart: build a breakable obstacle in this order

  1. Add a Swarm Flow Modifier sized to the opening, Route set to Extra Cost.
  2. Add a Swarm Breakable, and set Max Health for how long it should hold.
  3. Leave Agents Attack It on for strikes and crowd pressure together, or set Strike Damage Scale to 0 if only pressure should count.
  4. Set Hit Noise Radius and Break Noise Radius, or 0 on either to keep it quiet.
  5. If it opens and shuts, write a small script that flips IsOpen and pick its blocked-frame policy.