Interest Spots
An interest spot is something passing agents may stop for: a shop window, a notice board, a street performer. An agent that walks past may break off, go and stand at the spot for a while, and then carry on with what it was doing.
Interest spots are built on Interrupts. Read that page first for interrupt kinds and how to author the reaction an agent plays.
The short version
- Create an Interrupt Kind and a reaction for it in the Reactive tree.
- Add the
InterestSpotcomponent to the object and set its Kind. - Add a child object with a Sphere Collider and the
InterestSpotVolumecomponent. Size the collider to cover the path agents walk. - For a crowd, set Shape to
Gatheringand assign a Mark Group to Audience Marks.
The Interest Spot component
| Field | What it does |
|---|---|
| Kind | The interrupt kind offered to passing agents |
| Shape | Solo for one visitor at a time, Gathering for several |
| Activity Enabled | Whether the spot is offering. Off, nobody stops |
| Probability | The chance an agent stops, from 0 to 1. Rolled once each time the agent enters the volume |
| Spot Cooldown Seconds | How long after one agent accepts before the spot offers to another |
| Requirements | Optional. Only agents that meet these are offered. See Requirement System |
| Anchor | Solo only. The item the visitor stands at. Leave empty to use the Item on the same object |
| Audience Marks | Gathering only. The mark group the audience stands on |
Solo
One agent at a time visits the spot, standing at the anchor item's use spot. The spot makes no offers while a visitor is there, or while the item is reserved or in use by an agent doing something else.
Gathering
Several agents visit at once, each on its own mark. The spot stops offering when every mark is taken.
A gathering fills gradually. Only one agent is taken at a time, and Spot Cooldown Seconds sets the wait before the next. Lower it for a crowd that builds quickly.
Probability
The roll happens once per visit to the volume. An agent that fails it is left alone until it walks out and comes back in, so 0.15 means roughly one passer-by in seven stops, however long each takes to walk through.
Turning a spot on and off
Activity Enabled can be set from your own code, so a performer only draws a crowd while performing:
interestSpot.ActivityEnabled = true;
Disabling the component, or the volume, sends every current visitor back to what it was doing.
The Interest Spot Volume component
The volume is the area in which passing agents are noticed. It needs a collider set as a trigger and a kinematic Rigidbody. Adding the component sets both up for you.
| Field | What it does |
|---|---|
| Spot | The interest spot this volume belongs to. Leave empty to use one on the same object or a parent |
| Offer Tick Interval | Seconds between rounds of offers while agents are inside |
| Max Offers Per Tick | How many agents are considered each round. Agents are taken in turn, so a crowded volume stays cheap |
The Rigidbody is there because agents have none of their own, and Unity only reports trigger overlaps when one side has a Rigidbody. Keep it kinematic.
Size the volume to the route agents take, not to the spot itself. An agent only gets its chance while it is inside, so a volume it clips the corner of gives it one round of offers at most.
An empty volume costs nothing. It does no work until an agent walks in.
How long a visitor stays
The spot does not set this. The length comes from the endpoint behaviour on the reaction's action, so every spot using the same kind holds its visitors for the same time. Create a second kind and reaction for a spot that should hold agents longer.
Which agents stop
An agent is offered the spot when all of these are true:
- Activity Enabled is on and the spot cooldown has run out
- the spot has room
- the agent is not already handling an interrupt
- the agent meets the Requirements
- the agent's roll against Probability passes
The agent can still turn it down. Passing agents are asked at the Polite tier, so an agent that has already arrived at its task and begun is left to finish. The kind's cooldown and weight apply as well. See When an agent says no.
Common problems
| Symptom | Cause |
|---|---|
| Nobody ever stops | The volume's collider is not a trigger, agents do not pass through it, or Activity Enabled is off |
Agents are offered but decline with NoHandlerForKind | There is no reaction for the kind, or Reactive is None in module settings |
| Agents stop once and never again | The kind's Agent Cooldown Seconds. An agent also only rolls again after leaving the volume |
| A gathering only ever has one or two watching | Spot Cooldown Seconds is long compared with how long each visitor stays |
| A solo spot is never visited | The anchor item is reserved or in use, or there is no Item on the object and Anchor is empty |
| Agents at work walk straight past | The kind's weight does not beat the work weight, 0.7 by default. See Weight |
| Visitors all face the same way | The reaction's Look is not FACE_INTERRUPT_TARGET, or the marks all point the same way |
| The Console reports the collider must be a trigger | Tick Is Trigger on the volume's collider, or agents will walk into it |
Next step
Continue to Service Points, or open the Interrupt Scene from Example Scenes to see a solo spot and a gathering side by side.