Fusion Wave Trigger Driver

Photon Fusion Extension for Wave Trigger (New in 1.6.0)

Overview

FusionWaveTriggerDriver is the Photon Fusion driver for WaveTrigger in External mode.

Core behavior:

  • StateAuthority detects trigger enter/exit (based on executionTarget).

  • It replicates:

    • Inside/outside state via target.SetTriggerInside(bool)

    • Activation via target.ExternalActivate(bool scheduleLocalReset)

    • Reset via target.ExternalReset()

  • Replication is done using Fusion RPCs:

    • [Rpc(RpcSources.StateAuthority, RpcTargets.All, InvokeLocal = true)]

This keeps encounter triggers and activation synchronized across all clients.


Requirements

  • Photon Fusion installed (FUSION_WEAVER)

  • A NetworkObject on the same GameObject (required)

  • A WaveTrigger assigned (or present on the same GameObject)

  • A trigger collider volume (typically the WaveTrigger’s BoxCollider set to isTrigger)

  • WaveTrigger should be set to ActivationMode.External (recommended)

  • The triggering player must have a collider setup that actually produces trigger callbacks (Rigidbody rules still apply)

Enforced via:

  • [RequireComponent(typeof(NetworkObject))]


Inspector Reference

Target

Target (target) The WaveTrigger instance to drive. If not assigned, the driver uses GetComponent<WaveTrigger>().


Detection & Filtering

Activation Layers (activationLayers) Only colliders on these layers are allowed to activate.

Activator Tag (activatorTag) Optional tag filter (defaults to "Player"). Set to empty to disable tag filtering.

Tag matching checks:

  • Collider GameObject tag

  • Attached Rigidbody GameObject tag

  • Root transform tag

Require Input Authority Owned Collider (requireInputAuthorityOwnedCollider) If enabled, the driver will only accept colliders that belong to a NetworkObject whose:

  • InputAuthority == Runner.LocalPlayer

This is a best-effort filter using:

  • other.GetComponentInParent<NetworkObject>()

Use this when you want to ensure the activator is the locally-controlled player object (especially in Shared mode or multi-avatar setups).


Execution

Execution Target (executionTarget) Controls who is allowed to execute detection and broadcast inside/activate/reset.

Options:

  • Everyone

    • Detection logic is allowed to run on any peer

    • The driver still requires StateAuthority to proceed (see Runtime Behavior)

  • StateAuthorityOnly

    • Only StateAuthority runs detection

  • ServerOnly

    • Only the server runs detection (false in modes without a server)

  • SharedModeMasterClientOnly

    • Allows Shared mode “master client” semantics, and also StateAuthority

Important: regardless of the selection, the driver guards detection with:

  • Object.HasStateAuthority

So the authoritative peer remains the source of truth.


Wave Behavior

Auto Start On Enter (autoStartOnEnter) If enabled, when a valid activator enters the trigger volume:

  • driver RPCs inside=true

  • and if the target isn’t activated yet, driver RPCs Activate(...)

Schedule Local Reset On Start (scheduleLocalResetOnStart) If enabled, activation uses:

  • target.ExternalActivate(true)

This schedules a local reset cycle per the WaveTrigger implementation (offline-like). Typically keep false unless you explicitly want client-local reset timing.


Debug

Enable Logging (enableLogging) Enables logs.

Verbosity (logVerbosity)

  • ErrorsOnly

  • Normal

  • Verbose (includes early-outs and filter decisions)


Authority & Replication Model

Detection happens on StateAuthority

Trigger callbacks (OnTriggerEnter, OnTriggerExit) will only proceed if:

  • CanExecuteOnThisPeer() is true (based on executionTarget)

  • and Object.HasStateAuthority is true

Non-authority peers will not change state or send RPCs.

Replication uses RPCs from StateAuthority

These RPCs replicate to all peers and also run locally on the sender (InvokeLocal=true):

  • RPC_SetInside(bool inside)target.SetTriggerInside(inside)

  • RPC_Activate(bool scheduleLocalReset)target.ExternalActivate(scheduleLocalReset)

  • RPC_Reset()target.ExternalReset()


Runtime Behavior

Spawned()

When the NetworkObject is spawned:

  • Logs authority context (Shared master, state authority, input authority, runner mode, local player)

  • Ensures target is resolved (GetComponent<WaveTrigger>() if missing)

No state is forced here; inside/activation are driven by trigger callbacks and authority hooks.


Trigger enter

On StateAuthority, when a valid activator enters:

  1. Sets internal _insideAuthority = true

  2. RPCs inside=true:

    • RPC_SetInside(true)WaveTrigger.SetTriggerInside(true) on all peers

  3. If autoStartOnEnter is enabled and !target.IsActivated:

    • RPC_Activate(scheduleLocalResetOnStart)WaveTrigger.ExternalActivate(...) on all peers

The driver ignores repeated enters while already inside.


Trigger exit

On StateAuthority, when a valid activator exits:

  1. Sets internal _insideAuthority = false

  2. RPCs inside=false:

    • RPC_SetInside(false)WaveTrigger.SetTriggerInside(false) on all peers

The driver ignores exits if it was not inside.


Public Authority Hooks

These are convenience methods you can call from game logic (authority-only):

  • AuthorityEnter()

  • AuthorityExit()

  • AuthorityActivate(bool scheduleLocalReset = false)

  • AuthorityReset()

They all enforce:

  • Object.HasStateAuthority

  • CanExecuteOnThisPeer()

Use these for:

  • scripted encounters

  • UI buttons

  • debug console tools

  • triggering waves from mission systems


  1. Add a WaveTrigger volume in the scene and assign a WaveSpawner

  2. Set the WaveTrigger Trigger Driver Mode to External

  3. Add a NetworkObject to the driver GameObject

  4. Add FusionWaveTriggerDriver

  5. Configure:

    • Activation Layers (player layer(s))

    • Activator Tag (optional)

    • Require Input Authority Owned Collider (optional, recommended when needed)

    • Execution Target (usually StateAuthorityOnly)

    • Auto Start On Enter (usually enabled)


Common Troubleshooting

Trigger never fires

  • Ensure the trigger collider actually receives callbacks (Rigidbody rules apply)

  • Ensure the activator collider is on an allowed layer

  • If using tag filtering, ensure the tag matches collider / rigidbody / root

  • Ensure the driver object has StateAuthority where you expect

Trigger fires but wrong player causes it

Enable:

  • Require Input Authority Owned Collider and ensure the player collider is under a NetworkObject with correct InputAuthority.

Activation happens multiple times

The driver already prevents re-enter activation by tracking _insideAuthority and checking target.IsActivated. If you see repeated activations, it’s usually:

  • multiple colliders entering/exiting rapidly, or

  • multiple triggers overlapping, or the WaveTrigger itself being driven by UnityPhysics at the same time (ensure External mode).

Last updated