📘Add tooltip content

This page explains how to provide the content of the tooltip, either via Inspector or runtime scripting.

Option 1: Editor-Assigned Tooltip

  1. Add a TooltipObject to any GameObject.

  2. Add HoverObject to the it (by following instructions in Unity inspector)

  3. Set information type in inspector (Information tab - this is the content type to display on tooltip UI)

  4. Optionally adjust display behavior:

    • Delay, position, anchoring

✅ Done — this object now shows a tooltip when hovered!


Option 2: Runtime-Assigned Tooltip

Retrieve your TooltipObject component and assign information at runtime.

// Using basic text information
var textInfo = new TextTooltipInformation();
textInfo.Text = "Dynamic tooltip generated in code";

tooltipTarget.Information = textInfo;
// Using flexible information
var flexibleInfo = new FlexibleTooltipInformation();
flexibleInfo.AddValue(new SpriteDataValue()
{
    Identifier = "icon_1",
    Sprite = spriteReference
});
flexibleInfo.AddValue(new TextDataValue()
{
    Identifier = "text_1",
    Text = "Text content"
});

tooltipTarget.Information = flexibleInfo;

Option 3: Show Tooltips Manually

For full manual control:

TooltipManager.Current?.ShowTooltip(myInformation, worldPosition);
  • You can provide a custom position and override behavior.

  • You can provide custom delay

  • Useful for tutorials, tooltips triggered by events, etc.

To hide the tooltip manually only when information matches:

TooltipManager.Current?.HideTooltip(myInformation);

Last updated