Skip to main content

Input Events

You can read the input of a player's controller in a unified way across all platforms by using Udon Input Events. These events will work correctly even when the player has remapped their controls.

There are currently two types of events - Button and Axis, which include boolean and float values. Each event also holds a special UdonInputEventArgs object. You can also use Unity input methods and properties to directly read input data.

Button Events

Button events include a bool value which is true when the button is pressed and false when it is released.

InputJump

Spacebar on Desktop, typically a face button on controllers.

InputUse

Left-Click on Desktop, typically a trigger button on controllers.

InputGrab

Left-Click on Desktop, typically a grip button on VR controllers.

InputDrop

Right-Click on Desktop, press grip button on Vive Wands and some Windows Mixed Reality Controllers, release grip button on others.

Axis Events

Axis events have a float value which typically ranges between -1 and 1. When using a controller with analog sticks, a new event will be triggered for each change in value, from 0 to 0.1, then to 0.2, etc. Desktop users will output whole numbers: -1, 0, 1, etc.

InputMoveHorizontal

A and D on Desktop, typically the left stick/pad moving left and right on controllers.

InputMoveVertical

W and S on Desktop, typically the left stick/pad moving up and down on controllers.

InputLookVertical

Moving the mouse up and down on Desktop, typically the right stick up and down on gamepad and VR controllers.

InputLookHorizontal

Moving the mouse left and right on Desktop, turning left and right using the right stick/pad without Comfort Turning on VR controllers, typically the right stick left and right on gamepad controllers.

UdonInputEventArgs

This object is included in every input event, and holds additional data for the event which may be useful. We may add more data into this object in the future, let us know if you think of something handy you'd like to reference here. For now, it includes:

  • UdonInputEventType: BUTTON or AXIS
  • boolValue: True/False if this is a button event, false if it's an axis event (default value)
  • floatValue: Number between -1 and 1 for an axis event, 0 if it's a button event (default value)
  • handType: LEFT or RIGHT. Included for keyboard and mouse users as well (mouse is RIGHT, keyboard is LEFT).

OnInputMethodChanged

This event fires whenever a user switches input methods, like from Keyboard to Mouse, Controller, or Touchscreen. It includes a VRCInputMethod enum as its parameter.

Ambiguous Vive input names
  • VRCInputMethod.Vive is a Vive controller running through SteamVR.
  • VRCInputMethod.ViveXr is a Vive XR Elite Controller running via OpenXR.

Unity Input Methods and Properties

Udon can access some methods and properties from the UnityEngine.Input namespace. They provide detailed information about user input.

The following methods and properties are available in Udon:

Input Detection in VRChat Menus

Udon can't detect input while any of the following VRChat menus are open:

  • Main menu
  • Quick menu (Desktop or mobile only)
  • Text input popup

When you open a VRChat menu, Udon releases all held inputs, even if you continue holding them. For example:

  • If you hold the arrow key and open the VRChat menu, Input.GetButtonUp() returns true for that key.
  • If you hold the jump button and open the VRChat menu, Udon executes InputJump(false).

When you close a VRChat menu, Udon presses all held Unity inputs. For example:

  • If you hold the right arrow key while closing the VRChat menu, Input.GetButtonDown() returns true for that key.
  • If you hold the jump button and close the VRChat menu, Udon does not execute InputJump(true).