Author Topic: Tooltip  (Read 2865 times)

Ingot

  • Guest
Tooltip
« on: October 17, 2013, 12:39:34 PM »
I can't make the tooltips work.
Maybe I just don't understand how they work or something.

I have the tooltip object as seen in the attached screenshot,
and also added this code to a script attached to the button that I want a tooltip to appear for:

  1. void OnTooltip() {
  2.                
  3.         UITooltip.ShowText("Hovered");
  4.  
  5.     }

But, the tooltip does not appear. What am I doing wrong or not doing?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tooltip
« Reply #1 on: October 18, 2013, 06:08:35 PM »
Do you actually have a tooltip in your scene? Look at the inventory example. The tooltip is an object in the scene with UITooltip script attached. Without something like that, how can you display it?

Ingot

  • Guest
Re: Tooltip
« Reply #2 on: October 18, 2013, 06:45:36 PM »
Yes, the object named _ToolTip has the UITooltip script attached to it.
Here is a screenshot showing the object properties in the inspector.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tooltip
« Reply #3 on: October 18, 2013, 07:00:05 PM »
Why does it have such a massive scale?

Ingot

  • Guest
Re: Tooltip
« Reply #4 on: October 18, 2013, 07:12:24 PM »
I scaled up the object instead of the sliced sprite.
I fixed that and made it all scale of 1 for x, y, and z but the tooltip still does not display.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tooltip
« Reply #5 on: October 18, 2013, 07:16:50 PM »
Your tooltip object is disabled. Enable it. If you look closely in the character example, it starts off enabled.

Ingot

  • Guest
Re: Tooltip
« Reply #6 on: October 18, 2013, 07:22:03 PM »
True, I enabled it before testing it again. It was disabled while waiting for reply here.
Even with it enabled, I am not seeing a tooltip when hovering over my object. Maybe
I don't understand how it works or something. When it starts, it finds the Main Camera
and not the camera that is within the UI Root (2D) hiearchy, but I don't know if that
is important. It will now debug log from the OnTooltip method, but the image and text
are not showing.

Btw, which tutorial is the inventory ?
Is it this one: Example X - Character?
« Last Edit: October 18, 2013, 08:00:20 PM by Ingot »

Ingot

  • Guest
Re: Tooltip
« Reply #7 on: October 19, 2013, 11:39:14 AM »
I was able to get it working, but the tip was just hidden behind some other graphics.