Skip to main content

VRChat API

API

Methods

Classes

Enums

Supported Features


Methods

VRCInstantiate

StaticReturnsNameSummary
✔️GameObjectVRCInstantiate(GameObject original)Creates a local, non-synced copy of an object. See here for more information.

Classes

Utilities

static class VRC.SDKBase.Utilities

Methods

StaticReturnsNameSummary
✔️boolIsValid(object obj)Returns true if the specified object is valid and not a null reference, otherwise false. This is typically used to check VRCPlayerApi objects after a player has left the instance, or GameObject objects that have been destroyed.
✔️voidShuffleArray(int[] array)Randomly shuffles each element in the array.

VRCStation

class VRC.SDK3.Components.VRCStation / class VRC.SDKBase.VRCStation

Properties

TypeNameSummary
MobilityPlayerMobilityDetermines if the player be able to move. Default value is VRCStation.Mobility.Immobilize.
boolcanUseStationFromStationDetermines if the user can switch stations when sitting in a station. Default value is true.
RuntimeAnimatorControlleranimatorControllerUsed to override normal seating animations with a custom one.
booldisableStationExitIf the user cannot exit the station by usual means, use triggers to unseat the user
boolseatedIs this a station that the user should be sitting in? Default value is true. See here for more information.
TransformstationEnterPlayerLocationTransform used to define where the user should be transported to when seated
TransformstationExitPlayerLocationTransform used to define where the user should be transported to when they are unseated

Methods

ReturnsNameSummary
voidUseStation(VRCPlayerApi player)Uses the station
voidExitStation(VRCPlayerApi player)Exits the station

Networking

static class VRC.SDKBase.Networking

Properties

StaticTypeNameSummary
✔️boolIsMasterReturns if the local player is the instance master
✔️VRCPlayerApiLocalPlayerReturns the current player
✔️boolIsNetworkSettledReturns true if the network is ready

Methods

StaticReturnsNameSummary
✔️boolIsOwner(VRCPlayerApi player, GameObject obj)Returns if the given player is the owner over the object
✔️boolIsOwner(GameObject obj)Returns if the local player is the owner of the object
✔️VRCPlayerApiGetOwner(GameObject obj)Returns the owner of the given object
✔️voidSetOwner(VRCPlayerApi player, GameObject obj)Sets the provided player as the owner of the object
✔️boolIsObjectReady(GameObject obj)Returns if the object is ready
✔️voidDestroy(GameObject obj)Destroys the given object
✔️stringGetUniqueName(GameObject obj)
✔️DateTimeGetNetworkDateTime()
✔️doubleGetServerTimeInSeconds()Returns the current server time in seconds.
✔️intGetServerTimeInMilliseconds()Returns the current server time in milliseconds.
✔️doubleCalculateServerDeltaTime(double timeInSeconds, double previousTimeInSeconds)Calculates the difference between two server time stamps as returned by GetServerTimeInSeconds().

TrackingData

struct VRC.SDKBase.VRCPlayerApi.TrackingData

Properties

TypeNameSummary
Vector3positionThe position of the player's tracking point
QuaternionrotationThe rotation of the player's tracking point

UdonBehaviour

class VRC.Udon.UdonBehaviour

A UdonBehaviour can be fetched with GetComponent.
Currently does not support GetComponent<T>()

UdonBehaviour behaviour = (UdonBehaviour)GetComponent(typeof(UdonBehaviour));

Properties

TypeNameSummary
boolDisableInteractiveDetermines whether an object with an Interact event should accept pointer raycasts and show an interactable outline and tooltips.

Methods

ReturnsNameSummary
voidSendCustomEvent(string eventName)Runs a public method on the behaviour
voidSendCustomNetworkEvent(NetworkEventTarget target, string eventName)Runs a public method over the network
voidSendCustomEventDelayedSeconds(string eventName, float delaySeconds, EventTiming eventTiming)Executes a custom event on the behaviour after a time delay, measured in seconds.
voidSendCustomEventDelayedFrames(string eventName, int delayFrames, EventTiming eventTiming)Executes a custom event on the behaviour after a frame delay.
objectGetProgramVariable(string symbolName)Get a variable from the behaviour
voidSetProgramVariable(string symbolName, object value)Sets a variable on the behaviour
TypeGetProgramVariableType(string symbolName)Retrieves the type of the specified variable from the behaviour.
voidRequestSerialization()Triggers the serialization and transmission of any synced variable data to remote clients. This is typically used when a behaviour is set to manual syncing mode.

VRCPlayerApi

class VRC.SDKBase.VRCPlayerApi

Properties

TypeNameSummary
boolisLocalReturns if the given player is the local or remote
stringdisplayNameReturns the players display name
boolisMasterReturns if the player is the instance Master
intplayerIdReturns the players instance id

Methods

StaticReturnsNameSummary
boolIsPlayerGrounded()Returns if the player is on the ground or not
✔️intGetPlayerId(VRCPlayerApi player)Returns the players instance id
✔️VRCPlayerApiGetPlayerById(int playerId)Returns the player with the given id
✔️intGetPlayerCount()Returns the player count for the instance
✔️VRCPlayerApi[]GetPlayers(VRCPlayerApi[] players)Populates and returns an array with the current players in the instance. The array parameter must be preallocated with at least VRCPlayerApi.GetPlayerCount elements. See example
boolIsOwner(GameObject obj)Shows if the player is the owner of a gameObject with a UdonBehaviour on it
TrackingDataGetTrackingData(TrackingDataType tt)Returns the tracking data for the specified type
Vector3GetBonePosition(HumanBodyBones bone)Return position data for the given bone
QuaternionGetBoneRotation(HumanBodyBones bone)Return rotation data for the given bone
voidTeleportTo(Vector3 teleportPos, Quaternion teleportRot)Teleports the player to the position with rotation
voidTeleportTo(Vector3 teleportPos, Quaternion teleportRot, SpawnOrientation teleportOrientation)Teleports the player to the position, rotation, and the spawn orientation
voidTeleportTo(Vector3 teleportPos, Quaternion teleportRot, SpawnOrientation teleportOrientation, bool lerpOnRemote)Teleports the player to the position, rotation, the spawn orientation, and if you want to lerp on remote
voidEnablePickup(bool enable)Set if the player can use pickups or not (Need Testing)
voidSetPlayerTag(string tagName, string tagValue)Assigns a value to the tag for the player. Returns null if the tag has not been assigned. Note that player tags are not synchronized to remote clients.
stringGetPlayerTag(string tagName)Returns the value of the given tag for the player. Assign a value of null to clear the tag.
voidClearPlayerTags()Clears the tags on the given player
voidSetRunSpeed(float speed)Sets the player run speed
voidSetWalkSpeed(float speed)Sets the players walk speed
voidSetJumpImpulse(float impulse)Sets players jump impulse
voidSetGravityStrength(float strength)Sets the players gravity
voidSetStrafeSpeed(float speed)Sets the player's strafe speed. The default strafe speed is 2.0f.
floatGetRunSpeed()Returns the current run speed value
floatGetWalkSpeed()Returns the current walk speed value
floatGetJumpImpulse()Returns the current jump impulse value
floatGetGravityStrength()Returns the current gravity value
floatGetStrafeSpeed()Returns the player's current strafe speed.
boolIsUserInVR()Returns if the current user is in VR
voidUseLegacyLocomotion()Sets the locomotion to the old system
voidImmobilize(bool immobile)Prevents user from moving
voidUseAttachedStation()Sits the players down on the station (Requires VRC_Station on the same gameObject)
voidSetVelocity(Vector3 velocity)Sets the players velocity
Vector3GetVelocity()Returns the player velocity
Vector3GetPosition()Returns the player position
QuaternionGetRotation()Returns the player rotation
voidSetVoiceGain(float gain)Add boost to the Player's voice in decibels, range 0-24
voidSetVoiceDistanceNear(float near)The near radius, in meters, where volume begins to fall off. It is strongly recommended to leave the Near value at zero for realism and effective spatialization for user voices. In Meters, Range 0 - 1,000,000
voidSetVoiceDistanceFar(float far)This sets the end of the range for hearing the user's voice. Default is 25 meters. You can lower this to make another player's voice not travel as far, all the way to 0 to effectively 'mute' the player. In Meters, Range is 0 - 1,000,000
voidSetVoiceVolumetricRadius(float radius)A player's voice is normally simulated to be a point source, however changing this value allows the source to appear to come from a larger area. Keep this at zero unless you know what you're doing. In Meters, Range is 0 -1,000. Default 0
voidSetVoiceLowpass(bool enabled)When a voice is some distance off, it is passed through a low-pass filter to help with understanding noisy worlds. You can disable this if you want to skip this filter. For example, if you intend for a player to use their voice channel to play a high-quality DJ mix, turning this filter off is advisable.
voidSetAvatarAudioGain(float gain)Set the Maximum Gain allowed on Avatar Audio. Default is 10. In Decibels, Range 0-10
voidSetAvatarAudioNearRadius(float distance)This sets the maximum start of the range for hearing the avatar's audio. Default is 40 meters. You can lower this to make another player's avatar not travel as far, all the way to 0 to effectively 'mute' the player. Note that this is compared to the audio source's minDistance, and the smaller value is used.
voidSetAvatarAudioFarRadius(float distance)This sets the maximum end of the range for hearing the avatar's audio. Default is 40 meters. You can lower this to make another player's avatar not travel as far, all the way to 0 to effectively 'mute' the player. Note that this is compared to the audio source's maxDistance, and the smaller value is used.
voidSetAvatarAudioVolumetricRadius(float radius)An avatar's audio source is normally simulated to be a point source, however changing this value allows the source to appear to come from a larger area. This should be used carefully, and is mainly for distant audio sources that need to sound "large" as you move past them. Default is 40
voidSetAvatarAudioForceSpatial(bool force)If this is on, then Spatialization is enabled for avatar audio sources, and the spatialBlend is set to 1. Enabling this prevents avatars from using 2D audio.
voidSetAvatarAudioCustomCurve(bool allow)This sets whether avatar audio sources can use a pre-configured custom curve.
voidPlayHapticEventInHand(PickupHand hand, float duration, float amplitude, float frequency)Plays haptic feedback on the player's controller for the given hand.
VRCPickupGetPickupInHand(PickupHand hand)Returns the associated pickup object for the given hand.

InputManager

static class VRC.SDKBase.InputManager

Methods

StaticReturnsNameSummary
✔️boolIsUsingHandController()Returns whether or not the user is using a hand controller.
✔️VRCInputMethodGetLastUsedInputMethod()Returns the last input method used, or VRCInputMethod.Count if no input method was found.
✔️voidEnableObjectHighlight(GameObject obj, bool enable)Enables or disables object highlighting for the specified object.
✔️voidEnableObjectHighlight(Renderer r, bool enable)Enables or disables object highlighting for the specified renderer.

SerializationResult

struct VRC.Udon.Common

The results returned by the OnPostSerialization event.

Constructor

NameSummary
SerializationResult(bool success, int byteCount)Constructor. Note that this can only be called at editor time.

Properties

TypeNameSummary
boolsuccessWhether the serialization attempt was successful.
intbyteCountThe number of bytes that were serialized.

UdonInputEventArgs

struct VRC.Udon.Common.UdonInputEventArgs

Provides contextual data for an input event.

Properties

TypeNameSummary
UdonInputEventTypeeventTypeThe type of input event that was fired.
boolboolValueThe value of the input method when an InputJump, InputUse, InputGrab or InputDrop event is fired.
floatfloatValueThe value of the input method when an InputMoveHorizontal, InputMoveVertical, InputLookHorizontal or InputLookVertical event is fired.
HandTypehandTypeThe hand that the input event occurred on. For desktop users, the keyboard is the left hand and the mouse is the right hand.

VRCUrl

class VRC.SDKBase.VRCUrl

VRCUrl objects currently cannot be constructed at runtime in Udon and are typically constructed at editor time via editor scripts, or retrieved from a VRCUrlInputField.

Constructor

NameSummary
VRCUrl(string url)Constructor that takes a URL as input. Note that this can only be called at editor time.

Properties

StaticTypeNameSummary
✔️VRCUrlEmptyAn empty URL.

Methods

ReturnsNameSummary
stringGet()Retrieves the current value of the URL.

VRCUrlInputField

class VRC.SDK3.Components.VRCUrlInputField

A UI component for end users to input a custom URL and output to Udon programs as a VRCUrl.

Methods

ReturnsNameSummary
VRCUrlGetUrl()Retrieves the current value of the input field.
voidSetUrl(VRCUrl url)Sets the URL displayed in the input field.

VRCMirrorReflection

class VRC.SDK3.Components.VRCMirrorReflection / class VRC.SDKBase.VRC_MirrorReflection

A component that manages a mirror surface on an object.

Properties

TypeNameSummary
boolm_DisablePixelLightsDisables real-time pixel shaded point and spot lighting. Pixel shaded lights will fall-back to vertex lighting when this is enabled.
boolTurnOffMirrorOcclusionDisables occlusion culling on the mirror. Enable this if you see objects flickering in the mirror.
LayerMaskm_ReflectLayersOnly objects on the selected layers will be rendered in the mirror. Objects on the Water layer are never rendered in mirrors.

VRCObjectPool

class VRC.SDK3.Components.VRCObjectPool

VRC Object Pool provides a lightweight method of managing an array of game objects. The pool will manage and synchronize the active state of each object it holds.

Objects are made active by the pool via the TryToSpawn node, which will return the object that was made active, or a null object if none are available. Objects may be returned to the pool by the pool's owner, and automatically disabled, via the Return node.

When objects are enabled by the pool, the OnEnable event is fired, which an UdonBehaviour on the object may listen for. Note that the OnEnable() event fires before the udon Start() event.

Late joiners will have the objects automatically made active or inactive where appropriate.

Properties

TypeNameSummary
GameObject[]PoolThe objects being managed by this object pool.

Methods

ReturnsNameSummary
GameObjectTryToSpawn()Returns an unused object from the object pool where available, otherwise returns null.
voidReturn(GameObject obj)Places the specified object back into the pool, freeing it up for future reuse.

VRCObjectSync

class VRC.SDK3.Components.VRCObjectSync

This component will automatically sync the Transform (position, rotation scale) and Rigidbody (physics) of the object you put it on.

Properties

TypeNameSummary
boolAllowCollisionOwnershipTransferShould ownership of object transfer if it collides with an object owned by another player.

Methods

ReturnsNameSummary
voidSetKinematic(bool value)Changes the kinematic state, usually handled by the Rigidbody of the object but controlled here for sync purposes. When the kinematic state is on, this Rigidbody ignores forces, collisions and joints.
voidSetGravity(bool value)Changes the gravity state, usually handled by the Rigidbody of the object but controlled here for sync purposes.
voidFlagDiscontinuity()Trigger this when you want to teleport the object - the changes you make this frame will be applied without smoothing.
voidTeleportTo(Transform targetLocation)Moves the object to the specified location.
voidRespawn()Moves the object back to its original spawn location.

VRCAvatarPedestal

class VRC.SDK3.Components.VRCAvatarPedestal / class VRC.SDKBase.VRC_AvatarPedestal

A component used to display an avatar in a world, and allows users to switch to the associated avatar.

Properties

TypeNameSummary
stringblueprintIdBlueprint Id of the avatar to be shown.
TransformPlacementTransform to display the avatar on.
boolChangeAvatarsOnUseIf set to true, switches the user to the avatar set on the pedestal when used.
floatscaleHow big or small the avatar should be, only affects the pedestal avatar.

Methods

ReturnsNameSummary
voidSwitchAvatar(string id)Changes the blue print id associated with the pedestal and updates the view for all users.
voidSetAvatarUse(VRCPlayerApi instigator)Causes the player to switch to the associated avatar. instigator must be the local player as returned by Networking.LocalPlayer.

VRCPickup

class VRC.SDK3.Components.VRCPickup / class VRC.SDKBase.VRC_Pickup

A component used to allow objects to be picked up and held.

Properties

TypeNameSummary
ForceModeMomentumTransferMethodThis defines how the collision force will be added to the other object which was hit, using Rigidbody.AddForceAtPosition. Note that the force will only be added if AllowCollisionTransfer is on.
boolDisallowTheftIf other users are allowed to take the pickup out of some else's grip.
TransformExactGunThe position object will be held if set to Exact Gun.
TransformExactGripThe position object will be held if set to Exact Grip.
boolallowManipulationWhenEquippedShould the user be able to manipulate the pickup while the pickup is held if using a controller.
PickupOrientationorientationWhat way the object will be held.
AutoHoldModeAutoHoldShould the pickup remain in the users hand after they let go of the grab button.
stringInteractionTextTooltip text that is displayed when holding the pickup.
stringUseTextTooltip text that is displayed when hovering over the pickup.
floatThrowVelocityBoostMinSpeedHow fast the object needs to move to be thrown.
floatThrowVelocityBoostScaleHow much throwing should scale, higher = faster thrown while lower means slower throw speed.
boolpickupableDetermines whether you can pickup the object.
floatproximityThe maximum distance a player can be away from a pickup to interact with it.
VRCPlayerApicurrentPlayerThe player that is currently holding the pickup.
boolIsHeldDetermines whether the pickup is currently being held by a player.
PickupHandcurrentHandThe hand that the player is holding the pickup with.

Methods

ReturnsNameSummary
voidDrop()Drops the pickup if it is being held by a player.
voidDrop(VRCPlayerApi instigator)Drops the pickup if it is being held by a player. Note that the pickup will only drop if instigator is the player who is holding the pickup.
voidGenerateHapticEvent(float duration, float amplitude, float frequency)Plays haptic feedback on the player's controller. Default values are duration: 0.25, amplitude: 0.5, frequency: 0.5.
voidPlayHaptics()Plays haptic feedback on the player's controller.

VRCPortalMarker

class VRC.SDK3.Components.VRCPortalMarker / class VRC.SDKBase.VRC_PortalMarker

A component used to create portals to other rooms.

Properties

TypeNameSummary
stringroomIdRoom Id of the destination room.

Methods

ReturnsNameSummary
voidRefreshPortal()Refreshes the portal displayed to the player.

Enums

EventTiming

enum VRC.Udon.Common.Enums.EventTiming

NameSummary
UpdateThe event is fired during the Update() event.
LateUpdateThe event is fired during the LateUpdate() event.

Mobility

enum VRC.SDKBase.VRCStation.Mobility

NameSummary
MobileAllow users to move when seated in station
ImmobilizePrevents user from moving
ImmobilizeForVehicleSame as Immobilized but optimized for moving stations

NetworkEventTarget

enum VRC.Udon.Common.Interfaces.NetworkEventTarget

NameSummary
AllAll players in the instance
OwnerOwner of the game object

SpawnOrientation

enum VRC.SDKBase.VRC_SceneDescriptor.SpawnOrientation

NameSummary
DefaultUse the VRChat default spawn behaviour (currently the same as AlignPlayerWithSpawnPoint)
AlignPlayerWithSpawnPointAligns player with the rotation of the spawn transform
AlignRoomWithSpawnPointAligns players room scale to be centered on spawn point

TrackingDataType

enum VRC.SDKBase.VRCPlayerApi.TrackingDataType

NameSummary
HeadThe player's head tracking data
LeftHandThe player's left hand tracking data
RightHandThe player's right hand tracking data
OriginThe player's playspace origin

VRCInputMethod

enum VRC.SDKBase.VRCInputMethod

NameValueSummary
Keyboard0Keyboard input method
Mouse1Mouse input method
Controller2Controller input method
Gaze3Gaze input method
Vive5Vive input method
Oculus6Oculus input method
Count7Maximum number of input methods available.

HandType

enum VRC.Udon.Common.HandType

NameSummary
RIGHTRight hand
LEFTLeft hand

UdonInputEventType

enum VRC.Udon.Common.UdonInputEventType

NameSummary
BUTTONButton event
AXISAxis event

VideoError

enum VRC.SDK3.Components.Video.VideoError

NameSummary
UnknownUnknown error
InvalidURLInvalid URL
AccessDeniedAccess Denied
PlayerErrorPlayer Error
RateLimitedRate Limited

AutoHoldMode

enum VRC.SDK3.Components.VRCPickup.AutoHoldMode / enum VRC.SDKBase.VRC_Pickup.AutoHoldMode

NameSummary
AutoDetectAutomatically detect which behaviour to apply.
YesAfter the grab button is released the pickup remains in the hand until the drop button is pressed and released.
NoAfter the grab button is released the pickup is let go.

PickupOrientation

enum VRC.SDK3.Components.VRCPickup.PickupOrientation / enum VRC.SDKBase.VRC_Pickup.PickupOrientation

NameSummary
AnyAny orientation
GripGrip orientation
GunGun orientation

PickupHand

enum VRC.SDK3.Components.VRCPickup.PickupHand / enum VRC.SDKBase.VRC_Pickup.PickupHand

NameSummary
NoneNo hand
LeftLeft hand
RightRight hand

Supported Features

Synced Variables

These variables are available for syncing across the network with the UdonSynced attribute.

note

In the lists below, 'size' refers to the approximate size in memory. When networked, the data is serialized, which may lead to more data being transmitted. For example, syncing a bool will send at least 1 byte of data (instead of 1 bit) in addition to any networking overhead. To find out how many bytes of serialized data were, use byteCount in the OnPostSerialization event. You can find more information about syncing on Udon's Network Specs page.

Boolean types

TypeSize
bool1 byte

Integral numeric types

TypeRangeSize
sbyte-128 to 1271 byte
byte0 to 2551 byte
short-32,768 to 32,7672 bytes
ushort0 to 65,5352 bytes
int-2,147,483,648 to 2,147,483,6474 bytes
uint0 to 4,294,967,2954 bytes
long-9,223,372,036,854,775,808 to 9,223,372,036,854,775,8078 bytes
ulong0 to 18,446,744,073,709,551,6158 bytes

Floating-point numeric types

TypeApproximate rangePrecisionSize
float±1.5 x 10^(−45) to ±3.4 x 10^(38)~6-9 digits4 bytes
double±5.0 × 10^(−324) to ±1.7 × 10^(308)~15-17 digits8 bytes

Vector mathematics types and structures (Unity)

TypeRangeSize
Vector2same as float8 bytes
Vector3same as float12 bytes
Vector4same as float16 bytes
Quaternionsame as float16 bytes

Color structures

TypeRange / PrecisionSize
Colorsame as float16 bytes
Color32same as byte4 bytes

Text types and structures

TypeRangeSize
charU+0000 to U+FFFF2 bytes
stringsame as char2 bytes / char

Other structures

TypeRangeSize
VRCUrlU+0000 to U+FFFF2 bytes / char