Immerse

Canvas Input

Description

Canvas (Unity documentation) is the main UI component that enables interactive user interfaces in a Unity application.

To interact with UI elements (such as buttons and scroll bars) on this canvas, Unity provides a ray caster (GraphicRaycaster (Unity documentation) ). Out of the box, this component does not recognise VR controllers.

How It Works

The Immerse SDK provides a feature to allow a VR user to interact with a world space canvas using the controller. When activated, a 'laser pointer' emanates from the index finger of the hand closest to the canvas. This pointer can then be used to interact with the canvas - pressing the controller trigger when the laser pointer is over a button activates that button, or holding down the trigger drags a scroll bar

A World Space canvas with 3 buttons

A controller input on the canvas

When activated, a 'laser pointer' emanates from the user's index finger

How To Implement

  1. Before allowing controller input, a World Space canvas (Unity documentation) must be set up correctly.

🚧

When creating the canvas, take care when setting the scale properties, as this directly relates to the size of the canvas. If not setup correctly, with a high enough resolution, pixelation may occur on the text and textures in VR.

  1. Add a GraphicRaycaster (Unity documentation) , for the controller input to work.

  2. Add an AllowControllerInput component, once the canvas is positioned and sized correctly in the world space. This component will deal with the necessary calculations and steps to let the SDK handle input from the controllers.

📘

Immerse SDK Class Library

More detail available in AllowControllerInput

Unity Editor Component

PropertyDescription
Is Distance Checking Enabled
If enabled, this will enable input for this canvas (the laser pointer) at a specified distance, if the controller is facing the canvas.
Distance In MetersThe distance in meters (radius from the Canvas position) to allow input

Updated 4 months ago


Canvas Input


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.