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.
- Mesh Visibility
- Changes the ability to see a GameObject's renderer
- 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.
- ParameterObject - The objects whose mesh will be turned on and off
- Animation Float
- Sets a float variable in an animation controller on the GameObject with the EventHandler
- ParameterString - Name of variable
- ParameterFloat - New value of the variable
- Animation Bool
- Set a boolean variable in an animation controller on the GameObject with the EventHandler
- ParameterString - Name of the variable
- ParameterBool - New value of the variable
- Animation Trigger
- Trigger a change in the GameObject's animation controller.
- ParameterString - Name of the trigger
- Audio Trigger
- This will cause an AudioScorce to play
- ParameterObject - GameObject with audio scource
- Note: if the ParameterObject = the EventHandlerObject, the audio source must be below the VRC_EventHandler script
- Play Animation
- This will cause a Unity legacy animation to play
- ParameterString - Name of the animation to play
- Note: The animation must be on the GameObject with the EventHandler
- Set Particle Playing
- Cause a particle effect to run on a ParticleSystem
- ParameterBool - True: call Play on particle system || False: call Stop on particle system
- The particle system component must be a child of the GameObject with the EventHandler
- Send Message
- This will call a function on scripts attached to the EventHandler's GameObject
- ParameterString - The name of the function to call
- Run Console Command
- 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"
- ParameterString - The console command to execute
- Set Game Object Active
- Sets a child object of the GameObject with the EventHandler active or inactive
- ParameterBoolOp - True: set object active, False: set object inactive, Toggle: switch between the two.
- 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 Edit
Triggers an event when a specific key is pressed
Triggers an event when "E" is released when within a certain distance from the GameObject with the script on it
Triggers an event between a certain amount of time from either enable or the last time it was called (if repeat is true)
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.
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.
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.
Adding this to any GameObject (e.g. a rotating sun / directional light) will synchronize transform position and rotation of the GameObject.
VRC_SimplePhysics requires your GameObject to be a RigidBody. The transform position of your RigidBody GameObject is synchronized between VRChat clients.
Adding this to a parent empty object containing your scene allows you to build the child objects as a room for VRChat.
Allows you to manually set a different reset position for your scene than your spawn.
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 Edit
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.
Adds the PlayerMod jump to scene, allowing everyone in the room to jump. You can set the jumpPower manually.
Let's you modify the speed players walk/run/jump in.
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 refered EventHandlers events.
The PlayerMod Health adds a healthbar to the player and let's you decide whether a player respawns or gets kicked upon death.
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).
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.
- 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)
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.
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
- 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 Edit
This is used in conjunction with VRC_EventHandler to add damage to the player.
- Use the VRC_EventHandler to define a SendMessage event with the parameter "AddDamage". Name this event something like "Damage".
- Add a VRC_AddDamage component in the same hierarchy. Define the amount of damage.
- 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.
- 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:
- The player falls into the pit
- They hit the trigger collider at the bottom of the pit. This triggers VRC_ColliderEventTrigger to send the "Damage" event up the hierarchy.
- The "Damage" event is received by VRC_EventHandler. This then does a SendMessage with the parameter of "AddDamage".
- The VRC_AddDamage component receives the SendMessage and applies damage to the player.
- The PlayerMod "Health" is updated with the amount of damage.
This works exactly like VRC_AddDamage except it will add health instead of removing it.
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
- Check the “Should Immobilize Player” box if the user shouldn’t be able to move when they use the station
- Add your custom animator controller to the Animator Controller parameter. This is the controller that will be applied when a player uses your station
- 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
Holds the location of where an object can be mounted on a player
The PropController is used in custom scripting to know when a player is holding certain buttons.
Programmer Oriented SDK ElementsEdit
Adding DataStorage to an object lets information be saved by custom scripts. The script can save a variety of values...
- VRC_SerializableBehavior scripts
VRC_SerializableBehavior has two virtual (overrideable) methods...
- GetBytes(), which returns a byte of the information that you want to save
- 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.
This is used to tell if "E" is being pressed on a GameObject by components.
Has a couple of variables...
- protected bool _isSelected
- protected RaycastHit _currentHit
- public Transform InteractTextPlacement
- public string InteractText
- public float proximity
- how close must the interaction occur for this object to be selected
- public GameObject InteractTextGO
- This is a GameObject at the interactTextPlacement transfrom with InteractText on a TextMesh
And has a couple of virtual methods...
- Does initialization of components. If overriden call base.Awake() to keep init code.
- Does nothing as of the moment
- Select(Raycast hit)
- 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
- sets _isSelected to false, _currentHit to empty and removes the interact text
- Blank method called when "E" is released. Override this to add functionality