{"_id":"594949e92be16d0026ec0549","category":{"_id":"594949e62be16d0026ec04cf","version":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-31T16:56:01.612Z","from_sync":false,"order":1,"slug":"prefabs","title":"Prefabs"},"user":"571fa519db52d01700f5cf3d","project":"571fa55ca0acd42000af9545","parentDoc":null,"version":{"_id":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":2,"createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["594949e62be16d0026ec04ce","594949e62be16d0026ec04cf","594949e62be16d0026ec04d0","594949e62be16d0026ec04d1","594949e62be16d0026ec04d2","594949e62be16d0026ec04d3","594949e62be16d0026ec04d4","594949e62be16d0026ec04d5","594949e62be16d0026ec04d6","594949e62be16d0026ec04d7","594949e62be16d0026ec04d8","594949e62be16d0026ec04d9","594949e62be16d0026ec04da","594949e62be16d0026ec04db","594949e62be16d0026ec04dc","594949e62be16d0026ec04dd","594949e62be16d0026ec04de","594949e62be16d0026ec04df","594949e62be16d0026ec04e0","594949e62be16d0026ec04e1","59497219f4a8980024dd0631"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Kunekune","version_clean":"3.2.0","version":"3.2.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-31T16:57:15.644Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"## Overview\n\nThis 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.\n\nThere 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.\n\n## Inspector Parameters\n\n * **Display Text:** The text that is displayed on the tooltip.\n * **Font Size:** The size of the text that is displayed.\n * **Container Size:** The size of the tooltip container where `x = width` and `y = height`.\n * **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.\n * **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.\n * **Line Width:** The width of the line drawn between the tooltip and the destination transform.\n * **Font Color:** The colour to use for the text on the tooltip.\n * **Container Color:** The colour to use for the background container of the tooltip.\n * **Line Color:** The colour to use for the line drawn between the tooltip and the destination transform.\n * **Always Face Headset:** If this is checked then the tooltip will be rotated so it always face the headset.\n\n## Class Events\n\n * `ObjectTooltipReset` - Emitted when the object tooltip is reset.\n * `ObjectTooltipTextUpdated` - Emitted when the object tooltip text is updated.\n\n## Unity Events\n\nAdding the `VRTK_ObjectTooltip_UnityEvents` component to `VRTK_ObjectTooltip` object allows access to `UnityEvents` that will react identically to the Class Events.\n\n * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`.\n\n## Event Payload\n\n * `string newText` - The optional new text that is given to the tooltip.\n\n## Class Methods\n\n### ResetTooltip/0\n\n  > `public virtual void ResetTooltip()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * _none_\n\nThe ResetTooltip method resets the tooltip back to its initial state.\n\n### UpdateText/1\n\n  > `public virtual void UpdateText(string newText)`\n\n  * Parameters\n   * `string newText` - A string containing the text to update the tooltip to display.\n  * Returns\n   * _none_\n\nThe UpdateText method allows the tooltip text to be updated at runtime.\n\n## Example\n\n`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.","excerpt":"","slug":"objecttooltip","type":"basic","title":"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. * **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 ### ResetTooltip/0 > `public virtual void ResetTooltip()` * Parameters * _none_ * Returns * _none_ The ResetTooltip method resets the tooltip back to its initial state. ### UpdateText/1 > `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. ## 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.