The MetaCanvas prefab is a tool to aid developers in rapidly prototyping 2D user interfaces that support interactions both with Meta Hands and the Meta Mouse.

It is comprised of a mix of built-in Unity Canvas components and a handful of custom components to allow the Meta Mouse and the Meta Hands systems to interact with the Unity User Interface, or implementations using the Unity Event System.

The MetaCanvas GameObject contains a few major components:

  • Canvas - a built-in Unity component to contain UI elements
  • Canvas Scaler - a built-in Unity component to adjust canvas rendering
  • Graphic Raycaster - a built-in Unity component to pick UI elements on a Canvas
  • Meta Hand Graphics Raycaster - a Meta 2 SDK component which receives input data from UIEventTrigger then Raycasts into the scene to find Canvas UI components to interact with.

The MetaCanvas GameObject contains these additional child GameObjects:

  • UIEventTrigger
  • OrthogonalEventCamera

The UIEventTrigger contains the Box Collider component which controls the volume in which the user’s hand will start to generate inputs. These inputs are then forwarded to the Meta Hand Graphics Raycaster. Hands input not within this box are ignored by the Meta Canvas.

The UI Event Trigger script has three settings:

  • DownTriggerOffset - Offset from the front of the panel which the user’s finger must pass through to trigger down event. This is visualized by the purple box in the EventVolume.
  • UpTriggerOffset - Offset from the DownTriggerOffset which the user’s finger must pass through to trigger the up event, after the down event is triggered. This is visualized by the yellow box in the EventVolume. This is used for debouncing.
  • EventVolumeState - This optional event is used to subscribe to trigger events.