This document is about: FUSION 2
SWITCH TO

Watch menu

Fusion XR prototyping addons

This addons provides classes to create a simple interactable watch menu.
The watch menu opens when the user looks at the watch. Buttons appear, and the user can trigger actions by pressing them.

Fusion UI Synchronization

Implementation

As an example, in the addon's demo scene the buttons displayed above the watch trigger actions directly, while the settings buttons below the watch open configuration windows.
All of this is fully configurable, including the number of buttons in each menu.

Hardware & Network rigs

In the demo scene, the watch is attached to both the player's HardwareRig and the NetworkRig, so the user can interact with the watch menu even when not connected to the network.
If the project supports both controllers and hand tracking, the watch must be duplicated in each respective hierarchy folder.

RadialMenu

This class spawns the buttons and shows or hides them depending on the user's gaze, using the OpenRadialMenu() and CloseRadialMenu() functions called by WatchAim.
The button list can be edited in the Unity Editor to add or remove buttons on the radial watch menu.
The positions of the buttons are calculated automatically in order to place them around the watch.

In the demo scene, there is a single RadialMenu component on the HardwareRig to handle the menu associated to the strap under the watch when the user is offline.
Conversely, the NetworkRig contains two RadialMenu components : one for the buttons above the watch and another for the settings buttons below (when user is connected).

WatchWindowsHandler

This component is also present on both the HardwareRig and the NetworkRig.
It receives requests to open windows from the RadialMenuButtonWindows component on buttons intended to open a window.
It centralizes all user-opened windows in a list, manages their activation with ToggleWindow(), and keeps their position aligned with the user.

WatchWindow

Any window opened from a watch button should inherit from WatchWindow.
This base class triggers events when windows open or close and can update text fields through the WatchWindowsHandler.

WatchAim

This component, placed on the watch, checks whether the user is looking at it.
When they are, it instructs the configured radial menu to display its buttons.
Please note this class implements the IRigPartVisualizerGameObjectToAdapt interface in order to add the watch in the Game Objects To Adapt list of the RigPartVisualizer (added on runtime).

Buttons

Two button types are implemented :

  • Action buttons trigger an action directly (for example spawning an object) using the RadialMenuButtonAction class.
  • Window buttons open a configuration menu using the RadialMenuButtonWindows class.

RadialMenuButtonAction

This class listens to the Unity Button component's OnButtonClick event and handles visual, audio and haptic feedback.
Create your own subclass and override OnButtonClick() to define custom behavior when the user presses the button.

The shouldBeDisplayed variable allows you to dynamically show or hide a button on the watch menu.
For buttons that may need to be hidden, simply create a child class that inherits from the RadialMenuButtonAction classes in order to modify the shouldBeDisplayed variable.

The isActive parameter controls the button's state, determining whether it is highlighted or not.
You can therefore control the button's appearance by modifying this variable and calling UpdateButtonColor() in your classes that inherit from RadialMenuButtonAction.

RadialMenuButtonWindows

RadialMenuButtonWindows opens a window and inherits from RadialMenuButtonAction.
It takes as parameters the prefab of the window to spawn and an associated name.
These are passed to the WatchWindowsHandler, which manages the created window instances.
This class also listens to the onOpenWindow and onCloseWindow events of WatchWindow to update the button's status.

Because RadialMenuButtonWindows inherits from RadialMenuButtonAction, the shouldBeDisplayed variable allows you to dynamically show or hide a button on the watch menu.
For buttons that may need to be hidden, simply create a child class that inherits from the RadialMenuButtonWindows classes in order to modify the shouldBeDisplayed variable.

Demo

A demo scene can be found in Assets\Photon\FusionAddons\WatchMenu\Demo\Scenes\ folder.

The watch menu includes three buttons on each side. However, only two buttons are visible.
Indeed, on each menu, one button is not displayed to illustrate the use of shouldBeDisplayed parameter.
Two classes, RadialMenuButtonAction2 & RadialMenuButtonWindowsSettings2 inherit respectively from RadialMenuButtonAction and RadialMenuButtonWindows to set the shouldBeDisplayed variable based on the presence of a specific define.

Also, as an example, the first action button can be used only once, because the RadialMenuButtonAction1 class makes the button non-interactable.

Dependencies

  • XRShared addon

Download

This addon latest version is included into the Industries addon project

Supported topologies

  • shared mode & host mode

Changelog

  • Version 2.0.0: First release
Back to top