# GvrTooltip Class Reference

# GvrTooltip

A tooltip for displaying control schemes overlaying the controller visual using a Unity Canvas.

## Summary

Automatically changes what side of the controller the tooltip is shown on depending on the handedness setting for the player. Automatically fades out when the controller visual is too close or too far away from the player's head. Look at the prefab GvrControllerPointer to see an example of how to use this script.

### Inheritance

Inherits from: MonoBehaviour, [IGvrArmModelReceiver](https://developers.google.com/vr/reference/unity/interface/IGvrArmModelReceiver)

| ### Protected attributes ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1aede5625fcdbf2691234f0fe375ee32b1 = 0.0105f` | `const float` Y position for app button tooltips based on the standard controller visual. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1acffaa3e1b83db50796da3d19ee707689 = 0.0098f` | `const float` Z position for all tooltips based on the standard controller visual. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1a2b380f7cecf6e11fc506652ed64af305 = 0.0385f` | `const float` Y Position for touch pad tooltips based on the standard controller visual. |

| ### Protected static attributes ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1af3bde12c418672a6f9d224cf6ad401cc = Quaternion.Euler(0.0f, 0.0f, 180.0f)` | `readonly Quaternion` Rotation for a tooltip when it is displayed on the left side of the controller visual. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1ac9b7de474e1b4c9bf21f84b0b9523877 = new Vector2(-0.5f, 0.5f)` | `readonly Vector2` Pivot point for a tooltip, used for controlling what side the tooltip is on. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1acbc4058d0b7cde01234ed9c39a616667 = Quaternion.Euler(0.0f, 0.0f, 0.0f)` | `readonly Quaternion` Rotation for a tooltip when it is displayed on the right side of the controller visual. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1a9bc71a2e687a147621fb3d0b58a7c7a4 = new Vector2(0.5f, 0.5f)` | `readonly Vector2` Anchor point for a tooltip, used for controlling what side the tooltip is on. |

| ### Properties ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1abfe4669e7079718170d1d04e55481287` | `https://developers.google.com/vr/reference/unity/class/GvrBaseArmModel#classGvrBaseArmModel` Gets or sets the arm model reference. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1aeb00a85bee77649609392b53b1e3059a` | `Text` Gets the text field for this tooltip. |

| ### Public functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1ac5cb820a741b0bbf16c519c62089c221()` | `bool` Returns `true` if this tooltip is set to display on the inside of the controller. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1ae98ab7ca693cd9819734032f357d6071()` | `bool` Returns `true` if the tooltip should display on the left side of the controller. |

| ### Protected functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1a67a3cfe4a3d446ccbdb44962a4a54219()` | `float` Gets the meters-to-canvas scale. |
| `https://developers.google.com/vr/reference/unity/class/GvrTooltip#classGvrTooltip_1a6d1e6b85fccf9022935aeb991a739637(bool IsLocationOnLeft)` | `virtual void` Refreshes how the tooltip is being displayed based on what side it is being shown on. |

## Protected attributes

### APP_BUTTON_Y_POSITION_METERS

```c#
const float APP_BUTTON_Y_POSITION_METERS = 0.0105f
```
Y position for app button tooltips based on the standard controller visual.

### TOOLTIP_Z_POSITION_METERS

```c#
const float TOOLTIP_Z_POSITION_METERS = 0.0098f
```
Z position for all tooltips based on the standard controller visual.

### TOUCH_PAD_Y_POSITION_METERS

```c#
const float TOUCH_PAD_Y_POSITION_METERS = 0.0385f
```
Y Position for touch pad tooltips based on the standard controller visual.

## Protected static attributes

### LEFT_SIDE_ROTATION

```c#
readonly Quaternion LEFT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 180.0f)
```
Rotation for a tooltip when it is displayed on the left side of the controller visual.

### PIVOT

```c#
readonly Vector2 PIVOT = new Vector2(-0.5f, 0.5f)
```
Pivot point for a tooltip, used for controlling what side the tooltip is on.

### RIGHT_SIDE_ROTATION

```c#
readonly Quaternion RIGHT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 0.0f)
```
Rotation for a tooltip when it is displayed on the right side of the controller visual.

### SQUARE_CENTER

```c#
readonly Vector2 SQUARE_CENTER = new Vector2(0.5f, 0.5f)
```
Anchor point for a tooltip, used for controlling what side the tooltip is on.

## Properties

### ArmModel

```c#
GvrBaseArmModel ArmModel
```
Gets or sets the arm model reference.

The arm model reference.

### TooltipText

```c#
Text TooltipText
```
Gets the text field for this tooltip.

The tooltip text.

## Public functions

### IsTooltipInside

```c#
bool IsTooltipInside()
```
Returns `true` if this tooltip is set to display on the inside of the controller.

<br />

| Details ||
|---|---|
| **Returns** | Returns `true` if this instance is tooltip inside; otherwise, `false`. |

### IsTooltipOnLeft

```c#
bool IsTooltipOnLeft()
```
Returns `true` if the tooltip should display on the left side of the controller.

This will change based on the handedness of the controller, as well as if the tooltip is set to display inside or outside.

<br />

| Details ||
|---|---|
| **Returns** | Returns `true` if this instance is tooltip on left; otherwise, `false`. |

## Protected functions

### GetMetersToCanvasScale

```c#
float GetMetersToCanvasScale()
```
Gets the meters-to-canvas scale.

<br />

| Details ||
|---|---|
| **Returns** | The meters-to-canvas scale. |

### OnSideChanged

```c#
virtual void OnSideChanged(
  bool IsLocationOnLeft
)
```
Refreshes how the tooltip is being displayed based on what side it is being shown on.

Override to add custom display functionality.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `IsLocationOnLeft` | Whether the location is on the left. | |