Setting a Custom Exit Position for a VRCStation (stationExitPlayerLocation)

This example demonstrates how to set a custom position where the player will be placed when they exit a VRCStation.

How It Works:

  • Assign a VRCStation and a Transform (exit point) in the Inspector.

  • Interact to set the station’s exit point, defining where the player will appear when they leave the station.

  • If no exit point is set, the player will exit at the default station position.

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

public class CustomExitPoint : UdonSharpBehaviour
{
    public VRCStation station; // Assign a VRCStation in the Inspector
    public Transform exitPoint; // Assign a Transform in the Inspector

    public override void Interact()
    {
        if (station != null && exitPoint != null)
        {
            station.stationExitPlayerLocation = exitPoint;
            Debug.Log("Player exit point set to: " + exitPoint.position);
        }
        else
        {
            Debug.LogWarning("Missing station or exit point transform.");
        }
    }
}

Last updated