Logo
UI Elements

Tooltip

A flexible tooltip system

Overview

Tooltip displays informative text, icons, or custom content when the user hovers over an object. This component is ideal for inventory tooltips, UI explanations, skill descriptions, item previews, and general hover hints.


Usage

Add Tooltip component to any UI or 3D object

Make sure that Preset is assigned

Set title, description, and optional icon

Tooltip will appear when hovered (after showDelay, if any)

Custom Content

Custom content can override the default layout by assigning a Custom Content object, which can be found under the References foldout. It lets you use your own object or prefab as content, which can be useful for more complex layouts.

Customize Preset

  • Locate the Preset prefab
  • Open the prefab and customize it as needed

Create New Presets

You can create different presets and use them on different objects. To create a new preset:

  • Locate the Preset prefab
  • Duplicate the prefab (this is the fastest way to customize)
  • Open the new prefab and customize it to your liking

Properties

Content

NameTypeDescription
tooltipPresetGameObjectPrefab containing TooltipPreset
titlestringTooltip title text
descriptionstringTooltip description text
iconSpriteOptional icon
customContentGameObjectPrefab replacing default content

Localization

(Shown only if EVO_LOCALIZATION is enabled)

NameTypeDescription
enableLocalizationboolEnables localized content
localizedObjectLocalizedObjectReference for localization data
titleKeystringKey for localized title
descriptionKeystringKey for localized description

Settings

NameTypeDescription
followCursorboolFollows mouse position when true
is3DObjectboolUses OnMouseEnter and OnMouseExit
maxWidthfloatMaximum tooltip width
showDelayfloatDelay before showing
movementSmoothingfloatLerp smoothing for follow cursor

Animation

NameTypeDescription
animationTypeAnimationTypeNone, Fade, Scale, or Slide
animationDurationfloatAnimation duration
animationCurveAnimationCurveCurve for animation interpolation
scaleFromfloatStart scale for Scale animation
slideOffsetVector2Offset for Slide animation

AnimationType:

  • None
  • Fade
  • Scale
  • Slide

Position and Offset

NameTypeDescription
offsetPositionOffsetPositionPredefined offset direction
customOffsetVector2Used when offsetPosition is Custom
offsetDistancefloatDistance from target
screenEdgePaddingfloatPadding from screen bounds

OffsetPosition supports: Top, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, BottomRight, Custom

References

NameTypeDescription
tooltipCanvasCanvasCanvas used to render tooltip

Events

NameTypeDescription
onShowUnityEventInvoked when tooltip begins showing
onHideUnityEventInvoked when tooltip hides

Public Methods

NameParametersDescription
Show()NoneShows tooltip with delay
Hide()NoneHides tooltip with animation
HideImmediate()NoneImmediately destroys tooltip
SetContent(title, description, icon, custom)string, string, Sprite, GameObjectUpdates tooltip content
SetContent(customContent)GameObjectReplaces content with custom UI
IsVisible()NoneReturns true if tooltip is active

Code Example

TooltipExample.cs
using UnityEngine;
using Evo.UI;

public class TooltipExample : MonoBehaviour
{
    public Tooltip tooltip;

    void Start()
    {
        // Change default content
        tooltip.title = "Sword of Dawn";
        tooltip.description = "A legendary blade forged in ancient light.";
        tooltip.icon = someSprite;

        // Manual control
        // tooltip.Show();
        // tooltip.Hide();

        // Override content at runtime
        tooltip.SetContent("New Title", "Updated description", null);

        // Custom UI
        // tooltip.SetContent(customPrefab);

        // Check visibility
        bool visible = tooltip.IsVisible();
    }
}

On this page