Fusion Local Area Spawner Driver
Photon Fusion Extension for the Local Area Spawner (New in 1.6.0)
Overview
FusionLocalAreaSpawnerDriver is the Photon Fusion driver for LocalAreaSpawner that replicates inside/outside state using Fusion’s authority model.
Key behavior:
Trigger detection runs only on the peer(s) allowed by
executionTarget.State replication is always sent from StateAuthority via an RPC.
All clients apply the region state locally by calling:
LocalAreaSpawner.SetPlayerInRegion(bool)
This keeps region presence consistent across all peers while still allowing flexible “who runs detection” policies.
Requirements
Photon Fusion installed (
FUSION_WEAVER)A NetworkObject on the same GameObject (required)
A
LocalAreaSpawnercomponent (same object or child)A trigger collider configured for detection (commonly the BoxCollider on the LocalAreaSpawner object)
LocalAreaSpawnershould be set to ActivationMode.External (recommended)Scene must be running in play mode (driver uses runtime trigger callbacks and Fusion ticks)
This driver enforces NetworkObject via:
[RequireComponent(typeof(NetworkObject))]
It is also ordered early:
[DefaultExecutionOrder(-50)]
Inspector Reference
Detection
Activator Tag (playerTag)
Optional tag filter. If set, only colliders matching this tag are considered valid activators.
Leave empty to disable tag filtering.
Matching checks include:
Collider tag
Attached Rigidbody GameObject tag
Root transform tag
Activator Layers (activationLayers)
Optional layer mask filter. Leave as Everything to accept any layer.
Execution
Execution Target (executionTarget)
Controls who is allowed to execute detection logic and participate in broadcasting.
Options and meaning:
Everyone
Trigger callbacks can run everywhere (useful for local-only behaviors)
Replication still only originates from StateAuthority (see below)
StateAuthorityOnly
Only the peer with StateAuthority processes trigger callbacks
ServerOnly
Only a dedicated server peer runs detection (will be false in modes without a server)
SharedModeMasterClientOnly
In Shared Mode, allows the “master client” semantics, and also allows StateAuthority
Important: regardless of this setting, the driver guards replication with Object.HasStateAuthority.
Debug
Enable Logging (enableLogging)
Enables log output.
Verbosity (logVerbosity)
ErrorsOnly
Normal
Verbose (includes early-outs + filter decisions)
Authority & Replication Model
Detection authority (configurable)
Detection occurs via Unity trigger callbacks:
OnTriggerEnterOnTriggerStay(safety net for missed enters/teleports)OnTriggerExit
These callbacks only proceed when:
CanExecuteOnThisPeer()is true (based onexecutionTarget), andObject.HasStateAuthorityis true
So even if executionTarget is Everyone, the driver will not accept triggers unless the peer is StateAuthority.
Replication (always from StateAuthority)
Inside/outside is replicated to all peers using an RPC:
This ensures:
One authoritative source of truth
Deterministic, consistent region state across all clients
Runtime Behavior
On Spawned()
When the NetworkObject spawns:
The driver resolves the LocalAreaSpawner reference (
GetComponentor child)It forces the region to false (not inside) initially:
_region.SetPlayerInRegion(false)
It resets internal state tracking:
_isInsideAuth = false_lastSentInside = false
This prevents stale state from previous sessions / scene replays.
Trigger detection (StateAuthority only)
When a valid activator collider enters/stays/exits:
If accepted, the driver updates
_isInsideAuthIt applies the change immediately on the authority peer:
_region.SetPlayerInRegion(inside)
This gives instant local feedback on authority before replication arrives elsewhere.
Network tick replication (send-on-change)
In FixedUpdateNetwork():
If the peer can execute and has StateAuthority:
If
_isInsideAuthdiffers from_lastSentInside:Updates
_lastSentInsideSends
RpcSetInside(_isInsideAuth)to all peers
This avoids spamming RPCs; it only sends when the inside state changes.
Applying replicated state (all peers)
When RpcSetInside is received:
The driver resolves the LocalAreaSpawner again (safe for late component init)
Calls:
_region.SetPlayerInRegion(inside)
This triggers:
LocalAreaSpawner.onPlayerIsInRegion(region, inside)Trigger UnityEvents (
OnTriggerEnterEvent, etc.)Region UnityEvents (
OnRegionEntered, etc.) …based on your 1.6.0LocalAreaSpawnerimplementation.
Recommended Setup
Add a
LocalAreaSpawnerwith a BoxCollider trigger volumeSet
LocalAreaSpawnerTrigger Driver Mode to ExternalAdd a
NetworkObjectto the same GameObject as the driverAdd
FusionLocalAreaSpawnerDriverConfigure:
Activator Tag (optional)
Activator Layers
Execution Target (typically StateAuthorityOnly)
Common Troubleshooting
Region never activates
Confirm the object has StateAuthority on the peer you expect
Confirm the trigger collider is actually firing (Rigidbody presence, correct layers)
Confirm
activationLayersincludes the player collider’s layerIf
playerTagis set, confirm it matches the player object/root/rigidbody object
Region flickers active/inactive
Multiple colliders may be entering/exiting rapidly (e.g., child colliders)
Restrict
activationLayersUse a tag filter
Prefer a single “activation collider” on the player
I set ExecutionTarget = Everyone but it still doesn’t work on clients
That’s expected: this driver still requires Object.HasStateAuthority to accept trigger callbacks and replicate state. ExecutionTarget affects eligibility checks, but StateAuthority remains the source of truth.
Last updated