Interacting with UI
Last updated
Last updated
It is possible to interact with Unity UI using the controller and hand tracking.
Add a UI element such as a panel, button, or slider.
Select the Canvas Asset.
Change the Render Mode to 'World Space'.
Change the scale of the canvas to x: 0.001, y: 0.001, z: 0.001.
Set the canvas position to 0,0,0.
Edit the Canvas to the desired position, width and height.
Add a 'Pointable Canvas' component to the Canvas asset.
Drag the 'Canvas' Component onto the Canvas Property
Add a 'Ray Interactable' to the Canvas asset.
Drag the 'Pointable Canvas' Component onto the 'Pointable Element' Property
You could also add a Poke interactable instead if you want to add Poke functionality.
Add an Empty Gameobject to the Canvas.
Rename the asset 'Surface'.
Add a 'Plane Surface' Component to the 'Surface' asset.
Add a 'Clipped Plane Surface' component to the 'Surface' asset.
Drag the 'Plane Surface' component onto the 'Plane Surface' property.
Add a 'Bounds Clipper' component to the 'Surface' asset.
Increase the size of the clipper to the size of the Canvas asset.
Rotate the 'Canvas' to make sure the Surface asset is facing the right way (blue grid).
Drag the 'Bounds Clipper' component on top the 'Clipped Plane Surface' component under Clippers category by either adding a property manually, or dragging over the 'Clippers' heading.
Drag the 'Surface' asset into the 'Surface' property in the 'Ray Interactable' component on the Canvas Asset.
Select the 'Clipped Plane' Surface.
Select the 'EventSystem' Asset in the Hierarchy.
Remove the 'Standalone Input Module' component.
Add a 'Pointable Canvas Module' component
Add UI Elements such as buttons, scrollbars, dropdowns etc as needed in order to finish your Canvas UI.