Object Tooltip


Adds a World Space Canvas that can be used to provide additional information about an object by providing a piece of text with a line drawn to a destination point.

Prefab Usage:

  • Place the VRTK/Prefabs/ObjectTooltip/ObjectTooltip prefab into the scene hierarchy, preferably as a child of the GameObject it is associated with.
  • Set the Draw Line To option to the Transform component of the GameObject the Tooltip will be assoicated with.

Inspector Parameters

  • Display Text: The text that is displayed on the tooltip.
  • Font Size: The size of the text that is displayed.
  • Container Size: The size of the tooltip container where x = width and y = height.
  • Draw Line From: An optional transform of where to start drawing the line from. If one is not provided the centre of the tooltip is used for the initial line position.
  • Draw Line To: A transform of another object in the scene that a line will be drawn from the tooltip to, this helps denote what the tooltip is in relation to. If no transform is provided and the tooltip is a child of another object, then the parent object's transform will be used as this destination position.
  • Line Width: The width of the line drawn between the tooltip and the destination transform.
  • Font Color: The colour to use for the text on the tooltip.
  • Container Color: The colour to use for the background container of the tooltip.
  • Line Color: The colour to use for the line drawn between the tooltip and the destination transform.
  • Always Face Headset: If this is checked then the tooltip will be rotated so it always face the headset.

Class Events

  • ObjectTooltipReset - Emitted when the object tooltip is reset.
  • ObjectTooltipTextUpdated - Emitted when the object tooltip text is updated.

Unity Events

Adding the VRTK_ObjectTooltip_UnityEvents component to VRTK_ObjectTooltip 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

  • string newText - The optional new text that is given to the tooltip.

Class Methods


public virtual void ResetTooltip()

  • Parameters
    • none
  • Returns
    • none

The ResetTooltip method resets the tooltip back to its initial state.


public virtual void UpdateText(string newText)

  • Parameters
    • string newText - A string containing the text to update the tooltip to display.
  • Returns
    • none

The UpdateText method allows the tooltip text to be updated at runtime.


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.