Controlling Station Switching with canUseStationFromStation

This example demonstrates how to enable or disable a player's ability to switch between VRCStations while seated.

How It Works:

  • Attach this script to an interactable object.

  • Assign a VRCStation in the Inspector.

  • When interacted with:

    • It toggles the ability for players to switch from one station to another.

    • Logs the updated state in the Unity Console.

using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Components;

public class StationSwitchControl : UdonSharpBehaviour
{
    public VRCStation station; // Assign a VRCStation in the Inspector

    public override void Interact()
    {
        if (station != null)
        {
            // Toggle the ability to switch between stations
            station.canUseStationFromStation = !station.canUseStationFromStation;

            Debug.Log("Can use station from another station: " + station.canUseStationFromStation);
        }
    }
}

Last updated