Develop

UI Interaction Using Gaze

Updated: Aug 19, 2026

Overview

You can make a Unity Canvas respond to gaze, so users select UI elements by looking at them instead of pointing with a controller or a hand ray. Gaze suits menus, buttons, and other panel-based interfaces.

How do UI interactions using gaze work?

Interacting with user interfaces using gaze requires a GazeInteractor component on the interaction rig and a GazeInteractable component on the Canvas. The UI elements also have to be reachable as IConecastTargets, which is what GazeConecaster hit-tests against. IConecastTarget is an interface, not a component. You do not attach it yourself; ConecastableCanvas generates the targets for you.
Diagram of the gaze UI component chain. The interaction rig hosts a GazeInteractor that casts through a GazeConecaster. ConecastableCanvas on the Canvas discovers the Canvas graphics under a Selectable and generates the IConecastTargets the conecaster hit-tests, while GazeInteractable on the Canvas points its Root Canvas field at that ConecastableCanvas.

ConecastableCanvas

This component generates IConecastTargets from Canvas graphics, if those graphics are children of Unity’s Selectable components such as buttons and toggles. The GazeConecaster component finds these targets and magnetizes the gaze selection point to them.
Wire the top-level ConecastableCanvas to the GazeInteractable attached to the Canvas object. If there are nested Canvases, use the root.
ConecastableCanvas is experimental. Experimental types can change without a deprecation cycle.

Properties

Serialized memberDescription
Auto Generate Targets
If enabled, all graphics tied to Selectables under the attached Canvas are considered for conecasting. To set targets explicitly instead, disable this and attach ConecastableCanvasTarget components to the Selectables.
Inherit Mesh From Parent
If enabled, the Canvas Mesh and Surface fields are inherited from the parent ConecastableCanvas, if one is present. This is a convenience, so child ConecastableCanvas components do not need to wire these dependencies themselves.
Canvas Mesh
Optional. The CanvasMesh used for mesh canvas rendering, if one exists.
Surface
Optional. The ISurface used for mesh canvas hit-testing, if one exists.
Enable Debug Visuals
If enabled, outlines are drawn around graphics in the Canvas, visible in the headset. The outline is red if the target is invalid, as described in the usage notes and limitations.
Tiebreak Comparer
Optional. By default this component depth-sorts graphics so that equal candidates resolve consistently. To override that, assign a component implementing IComparer<GameObject> here.
The Conecastable Canvas component in the Inspector, showing Auto Generate Targets, the Mesh Canvas Rendering group, and Enable Debug Visuals.

Usage notes and limitations

  • A ConecastableCanvas component is required for each Canvas in the scene, including nested Canvases.
Diagram of nested Canvas requirements. A root Canvas hosts a GazeInteractable whose Root Canvas field points at the root ConecastableCanvas, and each nested child Canvas requires its own ConecastableCanvas.
  • Targets are clipped correctly only when they are in a cardinal orientation, meaning rotated by 0, 90, 180, or 270 degrees on the Z axis. The sides of all rects must be at right angles to one another, with parent RectMask2D components. If a target is rotated so that clipping may not work correctly, the debug visual is drawn red rather than green.
Illustration of conecast target clipping. Rects at Z rotations of 0, 90, 180, and 270 degrees clip correctly and draw a green debug outline, and a rect at 45 degrees may fail to clip and draws a red outline.
  • Masking works only for views with RectMask2D, not Mask. If you need a Mask, add a RectMask2D as well, to the viewport or a child, so that targets are clipped correctly.

ConecastableCanvasTarget

ConecastableCanvas normally finds every Selectable graphic and makes it conecastable. When you want to choose explicitly which graphics are included, attach ConecastableCanvasTarget components to the Selectable components and assign the target graphics. The graphics must be children of the Selectable. If you provide no graphics, ConecastableCanvas ignores that Selectable entirely. Use the Enable Debug Visuals setting of ConecastableCanvas to visualize these changes.
ConecastableCanvasTarget is experimental. Experimental types can change without a deprecation cycle.
The Conecastable Canvas Target component in the Inspector with two entries in the Graphics list, Background (Image) and Icon (Image).

Learn more