VRChat Wikia
Advertisement

VRChat has an SDK manual located on their Developer Hub.

Video Overview of the latest additions to the SDK. (YouTube)

Events[]

VRC_EventHandler[]

This script contains a list of events that can be triggered by other scripts. There are a variety of event types each requiring different parameters. Each event has a name which will be used to determine which event is triggered. Multiple events can have the same name. Note: Parameter Objects must be children of the event handler object in order to be useable.

  1. Mesh Visibility
    1. Changes the ability to see a GameObject's renderer
    2. ParameterBoolOp - If set to True or False, this will cause the mesh on the ParameterObject to turn on or off respectively. Setting to Toggle will switch between the two each time the event is called.
    3. ParameterObject - The objects whose mesh will be turned on and off
  2. Animation Float
    1. Sets a float variable in an animation controller on the GameObject with the EventHandler
    2. ParameterString - Name of variable
    3. ParameterFloat - New value of the variable
  3. Animation Bool
    1. Set a boolean variable in an animation controller on the GameObject with the EventHandler
    2. ParameterString - Name of the variable
    3. ParameterBool - New value of the variable
  4. Animation Trigger
    1. Trigger a change in the GameObject's animation controller.
    2. ParameterString - Name of the trigger
  5. Audio Trigger
    1. This will cause an audio source to play
    2. ParameterObject - GameObject with audio source
    3. Note: if the ParameterObject = the EventHandlerObject, the audio source must be below the VRC_EventHandler script
  6. Play Animation
    1. This will cause a Unity legacy animation to play
    2. ParameterString - Name of the animation to play
    3. Note: The animation must be on the GameObject with the EventHandler
  7. Set Particle Playing
    1. Cause a particle effect to run on a ParticleSystem
    2. ParameterBool - True: call Play on particle system || False: call Stop on particle system
    3. The particle system component must be a child of the GameObject with the EventHandler
  8. Send Message
    1. This will call a function on scripts attached to the EventHandler's GameObject
    2. ParameterString - The name of the function to call
  9. Run Console Command
    1. Sends console command to players that generate a specific event (only the person who entered a trigger for example). These commands can be any that a user can input into the console like "/SetAvatar ..." or "/Pad"
    2. ParameterString - The console command to execute
  10. Set Game Object Active
    1. Sets a child object of the GameObject with the EventHandler active or inactive
    2. ParameterBoolOp - True: set object active, False: set object inactive, Toggle: switch between the two.
    3. ParameterObject - The object to set active or inactive [SDK Documentation]

The following are all scripts that allow content creators to trigger events on event handlers[]

VRC_KeyEvents[]

Triggers an event when a specific key is pressed

VRC_UseEvents[]

Triggers an event when "E" is released when within a certain distance from the GameObject with the script on it

VRC_TimedEvents[]

Triggers an event between a certain amount of time from either enable or the last time it was called (if repeat is true)

VRC_TriggerColliderEventTrigger[]

Triggers an event when a player enters a collider trigger object.

This works in conjunction with VRC_EventHandler to receive the events. Add this script to an object that has a collider on it. Then fill in the "Event" field with the event you want to trigger. Your VRC_EventHandler should be on the same object or higher up in the same hierarchy.

Objects[]

VRC_ObjectApi[]

Adding the VRC_ObjectApi was required for custom scripted control on objects, but the VRC_ObjectSync has improved with SDK Version 2015.05.27 and adding it is not necessary anymore.

VRC_ObjectSpawn[]

Adding the VRC_ObjectSpawn to a GameObject (preferably an empty object) allows you to spawn an attached prefab parentless in world space (not as the child object of the VRC_ObjectSpawn object).

The prefab will appaer as "prefabname(Clone)" in the scene.

VRC_ObjectSync[]

Adding this to any GameObject (e.g. a rotating sun / directional light) will synchronize transform position and rotation of the GameObject.

VRC_SimplePhysics[]

VRC_SimplePhysics requires your GameObject to be a RigidBody. The transform position of your RigidBody GameObject is synchronized between VRChat clients.

Scene[]

VRC_SceneDescriptor[]

Adding this to a parent empty object containing your scene allows you to build the child objects as a room for VRChat.

VRC_SceneResetPosition[]

Allows you to manually set a different reset position for your scene than your spawn.

VRC_SceneSmoothShift[]

This script receives a message called “Shift” which causes it to move between two predesigned positions.  This is good for sliding or rotating doors, elevators or sliding platforms. [SDK Documentation]

Scene Features[]

VRC_PlayerMods[]

Adding this to your Scene allows you to add following PlayerMods to your room.

PlayerMods can be triggered by Use Events or are recognized as room PlayerMods by setting "isRoomPlayerMods" to true.

  • Jump

Adds the PlayerMod jump to scene, allowing everyone in the room to jump. You can set the jumpPower manually.

  • Speed

Let's you modify the speed players walk/run/jump in.

  • Voice

Let's you modify the talk distance for the rooms voice and enables/disables 3D audio.

However, voice is default for a Scene, you don't need to add this mod for enabling voice chat.

  • Room Keys

Adds keys to your room to call events with. Players can use the keys to call referred EventHandlers events.

  • Health

The PlayerMod Health adds a healthbar to the player and let's you decide whether a player respawns or gets kicked upon death.

  • Gun
  • Prop

VRC_AvatarPedestal[]

Allows you to show an avatar (in idle animation) by name or URL on a certain position. It's possible to add events to allow players to switch to that avatar.

Take a look at the SDKs prefabs for the AvatarPedestal example prop (contains Use Event).

VRC_SlideShow[]

VRC_WebPanel[]

Converts a Game Object to a Web Panel. Note that if placed on a cube it will create a web-panel on all 6 surfaces. To find out how to use a Web Panel in VRChat, click here.

Parameters

  • Default URL - The URL that loads on the Web Panel by default
  • Resolution Width - Self Explanatory (800 / 1280 / 1920 / etc)
  • Resolution Height - Self Explanatory (600 / 720 / 1080 / etc)
  • Interactive - Unknown (User cannot click elements when enabled and can still use /web when disabled)

VRC_JukeBox[]

To get a JukeBox to work, add an Audio Source and and Audio Listener to the Game Object that you attach the script to. All the songs go in the "Songs" list in the VRC_JukeBox script itself. The volume is set through the Audio Source, whilst the "AudioClip" or "Output" variables can be left blank.

VRC_PortalMaker[]

Creates a Portal. For this to work the Collider of the Game Object needs to be enabled, and the "Is Trigger" option must be ticked.

For usage of the PortalMaker you can use this unity prefab as an example: https://goo.gl/w1sHKv

Parameters

  • Room Id - The ID of the room the portal goes to. An easy way to get the ID is join a room manually, then look at the Console for the ID by typing /room
  • Use Default Presentation - Does not seem to work (Portal looks identical both enabled / disabled)
  • Effect Prefab Name - Unknown

Scene Health, Damage, Guns[]

VRC_AddDamage[]

This is used in conjunction with VRC_EventHandler to add damage to the player.

Example Usage:

  1. Use the VRC_EventHandler to define a SendMessage event with the parameter "AddDamage". Name this event something like "Damage".
  2. Add a VRC_AddDamage component in the same hierarchy. Define the amount of damage.
  3. Ensure that you have added a player mod for "Health" under your VRC_PlayerMods. This is probably on your VRCWorld object. This will define the health of the current player.
  4. Use something to trigger the "Damage" event. For example, if you want to trigger damage when a player falls into a pit, put an object with a collider at the bottom of the pit and add a VRC_TriggerColliderEventTrigger to it. Then define the event in the trigger as "Damage". The collider object can have "isTrigger" checked if you just want to use it as a trigger.

Here's how this all works:

  1. The player falls into the pit
  2. They hit the trigger collider at the bottom of the pit. This triggers VRC_ColliderEventTrigger to send the "Damage" event up the hierarchy.
  3. The "Damage" event is received by VRC_EventHandler. This then does a SendMessage with the parameter of "AddDamage".
  4. The VRC_AddDamage component receives the SendMessage and applies damage to the player.
  5. The PlayerMod "Health" is updated with the amount of damage.

VRC_AddHealth[]

This works exactly like VRC_AddDamage except it will add health instead of removing it.

VRC_GunStats[]

Stations[]

VRC_Station[]

A station is a game object that a user can interact with in some way.  A basic example would be a chair. By using the VRC_Station script, you can give users the ability to sit in a chair.

To create a station simply add the VRC_Station component to the station game object 

  1. Check the “Should Immobilize Player” box if the user shouldn’t be able to move when they use the station 
  2. Add your custom animator controller to the Animator Controller parameter. This is the controller that will be applied when a player uses your station 
  3. Add a transform to the Station Player Location parameter if you want to move the player to a specific position/rotation when they use your event 

[SDK Documentation]

VRC_StationApi[]

VRC_StationInput[]

Props[]

VRC_PropApi[]

Holds the location of where an object can be mounted on a player

VRC_PropController[]

The PropController is used in custom scripting to know when a player is holding certain buttons.

VRC_PropStats[]

Programmer Oriented SDK Elements[]

VRC_DataStorage[]

Adding DataStorage to an object lets information be saved by custom scripts. The script can save a variety of values...

  1. Integers
  2. Floats
  3. Booleans
  4. String
  5. VRC_SerializableBehavior scripts

VRC_SerializableBehavior has two virtual (overrideable) methods...

  1. GetBytes(), which returns a byte[] of the information that you want to save
  2. SetBytes(byte[] bytes), which gives the script access to the byte[] saved by the server

To access these just make a class that extends VRC_SerializableBehavior and you're good to go.

VRC_Interactable[]

This is used to tell if "E" is being pressed on a GameObject by components.

Has a couple of variables...

  1. protected bool _isSelected
  2. protected RaycastHit _currentHit
  3. public Transform InteractTextPlacement
  4. public string InteractText
  5. public float proximity
    1. how close must the interaction occur for this object to be selected
  6. public GameObject InteractTextGO
    1. This is a GameObject at the interactTextPlacement transfrom with InteractText on a TextMesh

And has a couple of virtual methods...

  1. Awake()
    1. Does initialization of components. If overriden call base.Awake() to keep init code.
  2. Start()
    1. Does nothing as of the moment
  3. Select(Raycast hit)
    1. Checks if the distance a ray has moved is within the proximity and if it is _isSelected = true and _currentHit = hit. Interact text will also be put up
  4. Deselect()
    1. sets _isSelected to false, _currentHit to empty and removes the interact text
  5. Interact()
    1. Blank method called when "E" is released. Override this to add functionality

Uncategorized SDK elements[]

VRC_AvatarDescriptor[]

VRC_Editor[]

VRC_NetworkIdentifiable[]

VRC_PhysicsRoot[]

VRC_PlayerApi[]

VRC_RainObject[]

VRC_SyncAnimation[]

Advertisement