VRC_UiShape

Script used to make Unity UI interactable in VRChat. Requires a Unity UICanvas element on the same GameObject.

Steps to making an Interact-able UI with VRC_UiShape

  1. Add a Canvas using the right-click menu in your hierarchy.
  2. Add a VRC_UIShape component to the Canvas.
  3. Set the Canvas Render Mode to World Space.
  4. Reduce the x, y, and z scale of the Canvas. Usually somewhere between 0.001 and 0.005 will work well. This is the size in meters of a single pixel on the canvas.
  5. Set the Canvas GameObject layer to Default
  6. Add your UI elements to the Canvas

Common problems

If you have a canvas that does not make the VRChat pointer show up:

  • The canvas must have a VRC_UIShape component on it
  • The layer of the Canvas cannot be UI. Setting the canvas and all it's children to default will work.
  • The object with the VRC_UIShape must have a box collider. If there is none, one will be added automatically after the world is uploaded. However if you have added a collider yourself, you must make sure that it is the correct size.

If the pointer shows up but none of the UI is responsive:

  • The scene must have an EventSystem. This is added automatically when you make the canvas, so don't delete it.
  • Make sure that interact-able elements are not covered by invisible elements. This often happens when a text box overlaps and covers a button. There's a few solutions: You can rearrange the button so it is on top (lower in the hierarchy), you can resize the text so that it does not cover the button, or you can set the text's "raycast target" to false.

If the UI is responsive but does not do what you expect it to do:

  • Some UI events get removed in VRChat for security reasons. Make sure that the events you are trying to use are on this list
  • If you are using SendCustomEvent, make sure to type the event exactly the same both in the UI button and in the UdonBehaviour's event custom node
  • If something is wrong with an UdonBehaviour, it might halt which will stop it from doing anything. See this documentation for more details

Did this page help you?