Object Tooltip
Overview
This adds a UI element into the World Space 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.
There are a number of parameters that can be set on the Prefab which are provided by the VRTK_ObjectTooltip
script which is applied to the prefab.
Inspector Parameters
- Display Text: The text that is displayed on the tooltip.
- Font Size: The size of the text that is displayed.
- 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.
Class Methods
ResetTooltip/0
public void ResetTooltip()
- Parameters
- none
- Returns
- none
The ResetTooltip method resets the tooltip back to its initial state.
UpdateText/1
public 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.
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.
Updated less than a minute ago