There are a few steps required in order to enable cursor interaction for your application.
The XR Input Module extends Unity's Standalone Input Module with some XR specific requirements.
A prefab has been included in the package to help set up the Event System and is designed so that it is easy for you to customize it to fit your requirements. To add this prefab to your scene, you can use this menu item
GameObject > Create Other > Immerse > Interaction > UI > Event System. You should only ever have one of these in your scene at a time.
The XR Graphic Raycaster replaces Unity's owner Graphic Raycaster. This new component is based on the original, only enabling it to work with the XR Input Module.
A context menu item has been added to the Graphic Raycaster component to make it easy to replace. Right click the existing Graphic Raycaster and select 'Convert to XR Graphic Raycaster'.
It is important to use this component on all canvases that you want XR users to be able to interact with using the Cursor method.
The cursor will only be visible when it is over a UI element. This can make interaction difficult when elements are small or there are gaps in-between.
Place a transparent Image component within your canvas to set 'bounds' in which your cursor will always be visible.
The XR UI Pointer component is what is used to interact with the UI. These components would typically be attached to the hands/controllers in the Avatar Prefab.
|XR Node||Which XRNode should be used for input|
|Pointer Origin||Sets the origin and direction of the ray cast. If left empty, the attached Transform will be used|
|Scroll Speed||Controls the speed of thumbstick scrolling|
Updated about 1 year ago