Author Topic: Getting the UITooltip to work  (Read 5471 times)

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Getting the UITooltip to work
« on: October 30, 2012, 05:19:35 AM »
Here is what i did:

1.) Under anchor set up to center created new gameobject with UITooltip on it.
2.) Under that object label and sliced sprite (they are showing just fine in the scene)
3.) I linked label and slicedsprite to UITooltip inspector script fields
Tooltip does not show up when hovered over elements that are buttons for example (i was going trough the tuts and
I saw that elements does not need to have anything extra but colliders.

I am using the latest version of NGUI

I am wondering what else is needed tooltips to work? Something more than i am already doing?
Thanks!

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Re: Getting the UITooltip to work
« Reply #1 on: October 30, 2012, 05:54:55 AM »
ok i managed to do it by adding simple script to the object that i want to have tooltip with these lines

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

although i was getting !isFInite errors all over the place until i unlinked the background from the UITooltip script
now it works, it strangly shows the tooltip with background but it does not respect window screenedges it goes over the edge
and shows half of the tooltip. obviously i am not doing something the right way

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Getting the UITooltip to work
« Reply #2 on: October 30, 2012, 08:01:43 AM »
Look closer at the inventory example and how the tooltip is used there. It might give you an idea as to what you did wrong. Pay close attention to the hierarchy of the widgets in the tooltip.

StridingDragon

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Getting the UITooltip to work
« Reply #3 on: January 24, 2013, 01:39:47 AM »
I'm having trouble getting my tooltip to work as well and I  can't seem to find the inventory example anywhere. Can you tell me where it is? Is it part of the NGUI installation or is it hosted here on the site?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Getting the UITooltip to work
« Reply #4 on: January 24, 2013, 09:37:29 AM »
It doesn't come with NGUI free. It's only available in the full version.

StridingDragon

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Getting the UITooltip to work
« Reply #5 on: January 24, 2013, 02:57:06 PM »
Yeah, I assumed that much and bought the full version yesterday. Got it working now, but there is a very weird glitch I am experiencing.

When I create a label for the Tooltip, all of a sudden there is a weird gradient covering my scene, as you can see in the enclose screenshot. Interestingly, it has to do with the size of my label. I have it at 32x32 and the gradient shows. If I change it to 0.08x0.08 for example the gradient goes away. It changes depending on the size I enter. The font is okay. I've been using it in other places and it seems fine.

The other interesting thing about it is that the gradient does not show when I hit the "Play" button. It's only in the preview stage that it is visible.

Any ideas what might be going on here?
 

StridingDragon

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Getting the UITooltip to work
« Reply #6 on: January 24, 2013, 04:38:38 PM »
Here's another screenshot that shows what's really going on. For some reason the text is displayed in HUGE letters. See how tiny my actual fullscreen panel is by comparison? Somehow there seems to be something wrong with how my Tooltip Label is rendering the text, so when I'm close up to the panel to work, the gradient I see is actually the anti-aliasing of the huge font letters that are showing somewhere way off-screen.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Getting the UITooltip to work
« Reply #7 on: January 24, 2013, 08:13:27 PM »
Your tooltip is not in the right place in the UI hierarchy.

StridingDragon

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Getting the UITooltip to work
« Reply #8 on: January 24, 2013, 08:32:52 PM »
Okay, thanks. What IS the right place?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Getting the UITooltip to work
« Reply #9 on: January 24, 2013, 09:05:35 PM »
Has to be underneath UIRoot. If it's huge, it means it's not.

StridingDragon

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Getting the UITooltip to work
« Reply #10 on: January 24, 2013, 09:16:01 PM »
Nah, there is something wackier going on hereā€¦

As you can see from my first screenshot, I have "Tooltip" and under it, as a child, I have "Tooltip Label." If I move both of them up right under UIRoot, as you suggest. Nothing changes. It is the exact same problem.

If I split them and make "Tooltip Label" not a child of "Tooltip" it works - I have to manually resize it to 32x32, but the size is correct. The problem now is, however that the label no longer shows at the correct location on the screen as I hover over elements, because it is no longer parented correctly.

Am I missing something altogether here?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Getting the UITooltip to work
« Reply #11 on: January 25, 2013, 10:33:42 AM »
Don't look at the label. Look at the huge grey background -- what is it drawn by? Also check the scale of everything. All game objects leading up to your widgets must have a scale of (1, 1, 1), except UIRoot.

StridingDragon

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Getting the UITooltip to work
« Reply #12 on: January 25, 2013, 01:38:41 PM »
Thanks, Aren. That's what it was!

For some reason, the Tooltip was scaled to 400x400x400. I never touched the size, so it must have happened automatically when I created it. Not sure, why, but at least it's fixed now.  :)