Zones are a highly flexible tool for activating certain behaviours when an object or creature enter's its area of effect.
The Zone component has a number of UnityEvents that are invoked when something enters or exits its area of effect.
<aside> 🗒️ For more about UnityEvents and how to use them, refer to the official Unity Documentation.
</aside>
Field | Description |
---|---|
Invoke Player Exit On Awake | Causes the Player Exit event to be invoked immediately when the zone is loaded into the level. |
Navigation | |
Nav Speed Modifier | Enables the "Run Speed" effect. |
Run Speed | Sets the walking speed of the NPC creature that enters this zone. |
Kill | |
Kill Player | If enabled, this zone will kill the player immediately on entering its area. |
Kill NPC | If enabled, this zone will kill any NPC creature that enters its area. |
Despawn | |
Despawn NPC | If enabled, this zone will despawn any NPC that enters its area, living or dead, after the time specified by the 'Despawn Delay' field. |
Despawn Item | If enabled, this zone will despawn any item that enters its area after the time specified by the 'Despawn Delay' field. |
Despawn Delay | Specifies an amount of time (in seconds) to wait before despawning the NPC/Item that enters the zone's area. |
FX | |
Spawn Effect | If enabled, this zone will spawn an [effect][Effect] when something enters its area, positioned at the point of contact*. |
Effect ID | The ID of the effect to spawn. |
Effect Mass Velocity Curve | This curve maps the (mass * velocity) of the interactor at the moment of entry to the intensity of the effect. |
Effect Orientation | The euler rotation of the spawned effect. |
Teleport | |
Teleport Player | If enabled, this zone will move any player that enters this zone to the target position. |
Teleport Item | If enabled, this zone will move any item that enters this zone to the target position. |
Custom Teleport Target | Specifies the transform that will act as a target point for. |
Creature settings | |
Ignore Player Creature | If enabled, this zone will not react to the player creature. |
Ignore Non Root Parts | If enabled, this zone will only react to the root bone of creatures (hip bone). |
Portals | |
Portals | A list of [Zone Portals][ZonePortal] to update when the player enters this zone. |
Event | |
Player Enter Event | Invoked when a player creature enters the Zone's area. |
Player Exit Event | Invoked when a player creature leaves the Zone's area. |
Creature Enter Event | Invoked when a creature enters the Zone's area. |
Creature Exit Event | Invoked when a creature exits the Zone's area. |
Item Enter Event | Invoked when an item enters the Zone's area. |
Item Exit Event | Invoked when an item leaves the Zone's area. |
Entry events are invoked at inconsistent times. The chart below depicts the order in which zone effects are applied before the event is invoked.
Event | Order |
---|---|
Player Entry | Kill > Teleport > Update Portals > Invoked > Spawn Effect |
Creature Entry | Invoked > Spawn Effect > Kill > Despawn |
Item Entry | Spawn Effect > Teleport > Despawn > Invoked |
Zone effects will not spawn at the exact point of contact, rather the position will be approximated based on the what entered the zone.