【VRChat】Creating Teleporters: How to Instantly Move Players

Created: 2025-12-19

Implementation of teleporters and portals for comfortable world navigation. From basic teleportation using VRCPlayerApi.TeleportTo to portals with synced visuals.

Overview

In vast worlds or worlds divided into multiple areas, a means for players to move comfortably is essential. Teleporters and portals are powerful gimmicks that instantly move players to different locations, making world exploration easier.

In UdonSharp, this functionality can be easily implemented using the TeleportTo() method provided by VRCPlayerApi, the interface for controlling players.

This article explains specific scripts and setup methods, from basic teleporter implementation to more advanced applications.

  1. Basic Teleporter: Moves the player to a specified location when they touch or click an object.
  2. Random Teleporter: Moves the player to a random location among multiple candidates.

The VRCPlayerApi.TeleportTo() Method

This method is the core of teleport functionality. It forcibly changes a player's position and rotation.

player.TeleportTo(Vector3 position, Quaternion rotation);

  • player: The VRCPlayerApi object of the player to teleport. Use Networking.LocalPlayer to move yourself.
  • position: The destination world coordinates (Vector3).
  • rotation: The player's facing direction after moving (Quaternion).

In most cases, instead of specifying coordinates and orientation directly, it's convenient to use the Transform component of a marker GameObject placed in the scene. Transform contains both position and rotation information.

player.TeleportTo(destinationTransform.position, destinationTransform.rotation);

Note: TeleportTo() accepts a third argument for VRC_SceneDescriptor.SpawnOrientation. This controls how the player's orientation is determined after teleport (default is AlignPlayerWithSpawnPoint).

Pattern 1: Basic Teleporter (Trigger-Based)

A gimmick where the player teleports to a specified destination when entering a specific area (trigger). This is suitable for portal or magic circle style gimmicks.

Unity Editor Setup

  1. Create Teleport Source: Create an object to serve as the portal (e.g., decorated floor). Add a Box Collider to this object and check Is Trigger. This becomes the sensor that detects player entry.
  2. Create Teleport Destination: Create an empty GameObject and give it a clear name like "DestinationPoint." Place this where you want players to teleport. The blue Z-axis arrow indicates the player's forward direction after teleport, so adjust the object's orientation as well.
  3. Attach Script: Add an Udon Behaviour component to the teleport source object and assign the script described below.

Script: SimpleTeleporter.cs

using UdonSharp;
using UnityEngine;
using VRC.SDKBase;

public class SimpleTeleporter : UdonSharpBehaviour
{
    [Header("Settings")]
    [Tooltip("Assign the Transform indicating the teleport destination position and orientation.")]
    public Transform destination;

    // Called when a player enters the trigger
    public override void OnPlayerTriggerEnter(VRCPlayerApi player)
    {
        // Only process if the local player enters the trigger
        if (player.isLocal)
        {
            // Verify destination is set
            if (destination != null)
            {
                Debug.Log($"Teleporting {player.displayName} to {destination.name}.");
                player.TeleportTo(destination.position, destination.rotation);
            }
            else
            {
                Debug.LogError("Teleport destination is not set!");
            }
        }
    }
}

Final Unity Setup

  • Open the Inspector for the teleport source object.
  • Drag & drop the "DestinationPoint" object placed in the scene onto the Simple Teleporter component's Destination field.

Now, when a player enters the Collider range of the portal object, they will instantly teleport to the position and orientation of DestinationPoint.

Application: If you want to create an Interact-style teleporter, use the Interact event instead of OnPlayerTriggerEnter and call Networking.LocalPlayer.TeleportTo() inside it.

Pattern 2: Random Teleporter

A gimmick that teleports the player to one randomly selected location among multiple destinations. This is useful for mystery tours or when you want to scatter game respawn points.

Unity Editor Setup

  1. Create Teleport Source: Similar to Pattern 1, prepare an object that will be clicked or act as a trigger.
  2. Create Teleport Destinations: Create multiple empty GameObjects as teleport destinations (DestinationPoint_A, DestinationPoint_B, ...) and place them at various locations throughout the world.

Script: RandomTeleporter.cs

using UdonSharp;
using UnityEngine;
using VRC.SDKBase;

public class RandomTeleporter : UdonSharpBehaviour
{
    [Header("Settings")]
    [Tooltip("Assign multiple Transforms as teleport destination candidates.")]
    public Transform[] destinations;

    public override void Interact()
    {
        // Do nothing if no destinations are set
        if (destinations == null || destinations.Length == 0)
        {
            Debug.LogError("No teleport destination candidates are set!");
            return;
        }

        // Generate a random integer from 0 to number of destinations - 1
        int randomIndex = Random.Range(0, destinations.Length);

        // Get the randomly selected destination
        Transform randomDestination = destinations[randomIndex];

        // Verify the selected destination is valid
        if (randomDestination != null)
        {
            Debug.Log($"Teleporting to random destination: {randomDestination.name}.");
            Networking.LocalPlayer.TeleportTo(randomDestination.position, randomDestination.rotation);
        }
        else
        {
            Debug.LogWarning($"Destination at index {randomIndex} is invalid. Retrying.");
            // Error handling: e.g., call Interact again, choose another location, etc.
            Interact();
        }
    }
}

Final Unity Setup

  • Assign RandomTeleporter.cs to the teleport source's Udon Behaviour.
  • Click the lock icon to the right of the Random Teleporter component's Destinations field to enable editing the array size.
  • Enter the number of destinations in Size (e.g., 3).
  • Drag & drop each of the multiple "DestinationPoint" objects placed in the scene onto the displayed Element 0, Element 1, ... fields respectively.

Now, each time this object is Interacted, it will teleport to one random location among the registered destinations.

Summary

  • Player teleportation is implemented using the VRCPlayerApi.TeleportTo(position, rotation) method.
  • Use Networking.LocalPlayer to teleport yourself.
  • For teleport destinations, the easiest and most reliable approach is to place an empty GameObject as a "marker" in the scene and pass its Transform to the script.
  • Use OnPlayerTriggerEnter for trigger-based teleporters, and Interact for button-based teleporters.
  • Combining Transform arrays with Random.Range() makes random teleportation easy to implement.

Teleportation is a basic yet extremely powerful tool for making player experiences smoother and enriching world structure. Master this gimmick and create surprising spatial transitions for your players.