Logo
UI Elements

Tooltip

Contextual help on hover or selection

Overview

Tooltip displays supporting text when a target is hovered or selected. It can follow the cursor, anchor beside its target, or display custom content.

Preview

Usage

Add Tooltip to the target and assign Content -> Tooltip -> Preset. The supplied prefab is Evo UI/Prefabs/Overlays/Tooltip Preset.

Set Title, Description, and an optional icon.

Customize the options to your needs.


Customization

Creating a New Preset

A tooltip preset is a prefab with Tooltip Preset on its root. Duplicate the supplied prefab into your own project folder, or make a prefab variant, then open it in Prefab Mode.

Edit its background, typography, spacing, and icon layout. Keep the Title Text, Description Text, Icon Image, and layout references assigned on Tooltip Preset. Its Open Animation and Close Animation sequences control how the tooltip appears and disappears. Save the prefab and assign it to the target's Preset field.

Custom Content

Assign a UI prefab to Custom Content for a completely different layout, such as an item card. This takes priority over Preset: Tooltip positions the instance, but does not fill in its title, description, icon, or standard width layout. Configure those on the custom prefab. Add Tooltip Preset to its root if you want to configure its animation sequences.

Closed tooltips are reused instead of destroyed. Scripts on custom content receive OnEnable and OnDisable each time it shows and closes, but Awake and Start run only once.

Positioning

Use Max Width to wrap standard tooltip text, and adjust the offset and screen-edge padding to keep it readable. For scene objects, enable Is 3D Object and use a Collider so pointer hover can be detected. Target Canvas lets you choose where the tooltip renders; otherwise a default canvas is used.


Public API

Use Tooltip in the Evo.UI namespace.

Properties

NameTypeDescription
TitlestringTooltip title.
DescriptionstringSupporting text.
IconSpriteOptional icon.
InstanceTooltipPresetThe TooltipPreset that is shown or closing, or null. Closed tooltips are reused, so don't keep this reference after it closes.
IsVisibleboolWhether the tooltip is shown or closing.

Static Properties

NameTypeDescription
MaxPoolSizeintNumber of closed tooltips kept for reuse, shared by all tooltips. The default is 3. Set it to 0 to destroy them on close.

Fields

NameTypeDescription
showDelayfloatDelay before showing.
followCursorboolFollows pointer movement.
maxWidthfloatMaximum content width.
tooltipPresetGameObjectPrefab used for standard tooltip content.
customContentGameObjectCustom prefab that takes priority over tooltipPreset.

Methods

NameParametersDescription
Show()NoneShows the tooltip.
Hide()NoneCloses with animation.
HideImmediate()NoneCloses immediately.
SetContent()string newTitle, string newDescription, Sprite newIcon = null, GameObject newCustomContent = nullSets the title, description, and optional icon or custom content.
SetContent()GameObject newCustomContentSets a custom content object.

Events

NameTypeDescription
onShowUnityEventTooltip shown.
onHideUnityEventTooltip hidden.

Example

TooltipExample.cs
using UnityEngine;
using Evo.UI;

public class TooltipExample : MonoBehaviour
{
    [SerializeField] private Tooltip target;
    [SerializeField] private Sprite cloudIcon;

    private void Start()
    {
        target.SetContent("Cloud save",
            "Keep your progress available on another device.", cloudIcon);
        target.showDelay = 0.3f;
    }

    public void SetCloudSaveAvailable(bool available)
    {
        // Content properties also refresh a tooltip that is already visible.
        target.Description = available
            ? "Your progress is synced."
            : "Connect to the internet to sync your progress.";
    }
}

On this page