LinkedObjectSystem.md 4.2 KB

Linked Object System

Drives Animator bools, two audio objects, Udon scripts and a station from interactions and triggers: doors, buttons, pressure plates, lights, rides. It replaces the Interact Script, Logic Script, Pickup Detector and Player Trigger.

Requires:

  • Collider (set to Is Trigger for the trigger types; any collider for interactions)
  • A GameObject of its own, or one whose other Udon scripts use Manual sync (or none). It uses Manual sync itself, which can't share a GameObject with VRC Object Sync or Continuous scripts.

Debug Mode - Type: Boolean

  • Logs every change to the console.

Delayed Interact Time - Type: Float

  • How long a Temporary interaction stays on, in seconds.

Exclude Layers - Type: LayerMask

  • Pickups on these layers don't count for the Object trigger.

Trigger Type - Type: Enum

  • Who keeps the output on while inside the trigger:
    • None: the trigger isn't used.
    • Player: any player.
    • Object: any pickup (a GameObject with VRC Pickup).
    • Both Player And Object: either.

Interaction Type - Type: Enum

  • What interacting with the object does:
    • None: it can't be interacted with.
    • Permanent: turns the output on for good.
    • Temporary: turns it on for Delayed Interact Time seconds; it can't be used again until then.
    • Toggle: turns it on and off.

Output Animators / Output Parameter Names - Type: Arrays

  • Each Animator gets its matching bool parameter set to the output. Empty entries are skipped.

Audio Object True / Audio Object False - Type: GameObject

  • Audio Object True is active while the output is on, Audio Object False while it's off. Either can be left empty.

Output Behaviours / On Event Names / Off Event Names - Type: Arrays

  • Each Udon script gets its matching On Event Name called when the output turns on, and its Off Event Name when it turns off. Leave a name empty to send nothing for that change.

Network Events - Type: Boolean

  • Off (default): every player's client calls the events itself when its output changes, the same way the Animators are set. Players who join later get the current state's event when their output first changes.
  • On: only this object's owner calls the events, as network events to everyone. Use it when the target script should run once per change, decided by one player. Players who join later don't get past events, the target scripts need networking (not sync method None), and network event names can't start with _.
  • Default Value: false

Station - Type: VRCStation

  • The player who turns the output on by interacting, or who walks into the trigger, is seated in this station. They leave it themselves; turning the output off doesn't eject anyone.
  • A station holds one player. For several seats, use a Linked Object System per seat.
  • A player seated in a station more than a metre outside the trigger stops counting as inside it within a second, so the output can turn off while they ride. Put the station inside the trigger if the output should stay on.

Script Behavior:

  • The output is on while the interaction is on, or anyone or anything counted is inside the trigger.
  • Interactions are synced: everyone sees them, including players who join later.
  • Script events and the station follow the output: events on every change, the station when the local player turns it on or walks in.
  • Triggers aren't synced, because every player sees the same players and synced pickups enter. A player is only counted once, and players who leave the instance, or end up more than a metre away without walking out (seated in a station elsewhere), stop counting within a second. Pickups that are disabled or destroyed inside stop counting within a second too.

Upgrading from 1.0.x:

  • Interactions used to show only for the player who interacted; now they're synced.
  • Interactions and triggers used to share one counter, so a trigger could end a Temporary interaction early or stop a Toggle; now they're separate.
  • Audio objects used to switch only when both were assigned; now each works on its own.
  • The behaviour switches to Manual sync. If it shares a GameObject with VRC Object Sync or a Continuous script, move it to its own GameObject.