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.
- Place the
VRTK/Prefabs/ObjectTooltip/ObjectTooltipprefab into the scene hierarchy, preferably as a child of the GameObject it is associated with.
- Set the
Draw Line Tooption to the Transform component of the GameObject the Tooltip will be assoicated with.
- 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 = widthand
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.
ObjectTooltipReset- Emitted when the object tooltip is reset.
ObjectTooltipTextUpdated- Emitted when the object tooltip text is updated.
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
string newText- The optional new text that is given to the tooltip.
public virtual void ResetTooltip()
The ResetTooltip method resets the tooltip back to its initial state.
public virtual void UpdateText(string newText)
string newText- A string containing the text to update the tooltip to display.
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.
Updated less than a minute ago