# UI Interaction

## Hand Canvas Pointer

Simulates a cursor with clicking and sliding for interactions with [Unity Canvas UI ](https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/index.html)in VR.

Canvas's require Graphics Raycaster component

Should go on an empty transform under the hand or controller. Requires a line renderer which will be automatically shown/hidden when interacting with UI.&#x20;

<div align="left"><img src="https://2959669391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5zKO0EvOjzUDeT2aiFk3%2Fuploads%2FDr7lZQiy5CMNePAWSfK6%2Fimage.png?alt=media&#x26;token=daaaf23d-b4b6-49f1-aad2-1089fc52fe30" alt=""></div>

`Hit Point Marker` is an object that will appear and match the hit position and normal of the targeted UI only when targeting a UI

`Raycast Length` the max length of the UI pointer

`Auto Show Target` is whether or not you should point, or point and click to activate the pointer

`UI Layer` is the physics layer a pointer can point at

### Events

`Start Select` called when actively pointing at a valid UI and the HandCanvasPointer.Press() function is called

`Stop Select` called when actively pointing at a valid UI and the HandCanvasPointer.Release() function is called

`Start Point` called when start pointing at a valid UI

`Stop Point` called when stop pointing at a valid UI

This is where the UI Pointer is on the default prefab

<div align="left"><img src="https://2959669391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5zKO0EvOjzUDeT2aiFk3%2Fuploads%2FlIioneUEMubpbRggy7nh%2Fimage.png?alt=media&#x26;token=65c508ad-eb57-4abf-a08f-53fda0647456" alt=""></div>

### Controller Input

A general script with a Unity Event attached to a controller action

{% tabs %}
{% tab title="OpenXR" %}

## OpenXR

![](https://2959669391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5zKO0EvOjzUDeT2aiFk3%2Fuploads%2FzbxGDPvu0Lz6ERti45dm%2Fimage.png?alt=media\&token=7856180d-29bc-41d5-99cf-2fb42d51b8c5)
{% endtab %}

{% tab title="XR" %}

## XRControllerEvent

<div align="left"><img src="https://2959669391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5zKO0EvOjzUDeT2aiFk3%2Fuploads%2Fd4lT0QgCxxA1jjIb02iF%2Fimage.png?alt=media&#x26;token=ec711497-e320-4408-ae23-260ea23cb07d" alt=""></div>
{% endtab %}

{% tab title="Oculus Integration" %}

## OVRControllerEvent

<div align="left"><img src="https://2959669391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5zKO0EvOjzUDeT2aiFk3%2Fuploads%2FM3gkOly7jA9r7GXpPcU8%2Fimage.png?alt=media&#x26;token=4e0a244d-a2aa-4174-afd9-61377a8a5e01" alt=""></div>
{% endtab %}

{% tab title="SteamVR" %}

## SteamVRControllerEvent

<div align="left"><img src="https://2959669391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5zKO0EvOjzUDeT2aiFk3%2Fuploads%2FFKpUYmaBLMoji6pjcvBw%2Fimage.png?alt=media&#x26;token=96cc31e8-7b6f-42fb-b3c3-4e8d2ebd04c0" alt=""></div>
{% endtab %}
{% endtabs %}

### Advanced Information

On Start this component will generate a camera (which does not render or create additional graphics overhead) set each canvas in the scene to use that camera for UI interaction, and destroy any additional event systems.&#x20;

This system is not simultaneously compatible with desktop UI interaction or additional event systems in the scene
