Guides
These docs are for v3.2.0. Click to read the latest docs for v3.3.0.

Controller Tooltips

Overview

This adds a collection of Object Tooltips to the Controller that give information on what the main controller buttons may do. To add the prefab, it just needs to be added as a child of the relevant alias controller GameObject.

If the transforms for the buttons are not provided, then the script will attempt to find the attach transforms on the default controller model.

If no text is provided for one of the elements then the tooltip for that element will be set to disabled.

There are a number of parameters that can be set on the Prefab which are provided by the VRTK_ControllerTooltips script which is applied to the prefab.

Inspector Parameters

  • Trigger Text: The text to display for the trigger button action.
  • Grip Text: The text to display for the grip button action.
  • Touchpad Text: The text to display for the touchpad action.
  • Button One Text: The text to display for button one action.
  • Button Two Text: The text to display for button two action.
  • Start Menu Text: The text to display for the start menu action.
  • Tip Background Color: The colour to use for the tooltip background container.
  • Tip Text Color: The colour to use for the text within the tooltip.
  • Tip Line Color: The colour to use for the line between the tooltip and the relevant controller button.
  • Trigger: The transform for the position of the trigger button on the controller.
  • Grip: The transform for the position of the grip button on the controller.
  • Touchpad: The transform for the position of the touchpad button on the controller.
  • Button One: The transform for the position of button one on the controller.
  • Button Two: The transform for the position of button two on the controller.
  • Start Menu: The transform for the position of the start menu on the controller.
  • Controller Events: The controller to read the controller events from. If this is blank then it will attempt to get a controller events script from the same or parent GameObject.
  • Headset Controller Aware: The headset controller aware script to use to see if the headset is looking at the controller. If this is blank then it will attempt to get a controller events script from the same or parent GameObject.
  • Hide When Not In View: If this is checked then the tooltips will be hidden when the headset is not looking at the controller.
  • Retry Init Max Tries: The total number of initialisation attempts to make when waiting for the button transforms to initialise.
  • Retry Init Counter: The amount of seconds to wait before re-attempting to initialise the controller tooltips if the button transforms have not been initialised yet.

Class Events

  • ControllerTooltipOn - Emitted when the controller tooltip is turned on.
  • ControllerTooltipOff - Emitted when the controller tooltip is turned off.

Unity Events

Adding the VRTK_ControllerTooltips_UnityEvents component to VRTK_ControllerTooltips object allows access to UnityEvents that will react identically to the Class Events.

  • All C# delegate events are mapped to a Unity Event with the On prefix. e.g. MyEvent -> OnMyEvent.

Event Payload

  • VRTK_ControllerTooltips.TooltipButtons element - The tooltip element being affected.

Class Methods

ResetTooltip/0

public virtual void ResetTooltip()

  • Parameters
  • none
  • Returns
  • none

The Reset method reinitalises the tooltips on all of the controller elements.

UpdateText/2

public virtual void UpdateText(TooltipButtons element, string newText)

  • Parameters
  • TooltipButtons element - The specific controller element to change the tooltip text on.
  • string newText - A string containing the text to update the tooltip to display.
  • Returns
  • none

The UpdateText method allows the tooltip text on a specific controller element to be updated at runtime.

ToggleTips/2

public virtual void ToggleTips(bool state, TooltipButtons element = TooltipButtons.None)

  • Parameters
  • bool state - The state of whether to display or hide the controller tooltips, true will display and false will hide.
  • TooltipButtons element - The specific element to hide the tooltip on, if it is TooltipButtons.None then it will hide all tooltips. Optional parameter defaults to TooltipButtons.None
  • Returns
  • none

The ToggleTips method will display the controller tooltips if the state is true and will hide the controller tooltips if the state is false. An optional element can be passed to target a specific controller tooltip to toggle otherwise all tooltips are toggled.

Example

VRTK/Examples/029_Controller_Tooltips displays two cubes that have an object tooltip added to them along with tooltips that have been added to the controllers.