Setting a Custom Entry Position for a VRCStation (stationEnterPlayerLocation)

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

How It Works:

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

  • Interact to set the station’s entry point, defining where the player will appear when seated.

  • If no entry point is set, the player will use the station’s default location.

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

public class CustomEntryPoint : UdonSharpBehaviour
{
    public VRCStation station; // Assign a VRCStation in the Inspector
    public Transform entryPoint; // Assign a Transform in the Inspector

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

Last updated