Author Topic: UITooltip.cs Disappears Very Quickly  (Read 12490 times)

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
UITooltip.cs Disappears Very Quickly
« on: December 30, 2015, 04:16:00 PM »
I've been using the UITooltip example for the tooltips in my game and it works nicely. One issue I have with it is that the tooltips (once shown) disappear really quickly - like maybe 1 second later. I can't for the life of me track down why this happens. Is anyone able to assist?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITooltip.cs Disappears Very Quickly
« Reply #1 on: January 01, 2016, 07:04:38 PM »
Put a Debug.Log in UITooltip.Hide and find out.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UITooltip.cs Disappears Very Quickly
« Reply #2 on: January 03, 2016, 05:02:15 PM »
Put a Debug.Log in UITooltip.Hide and find out.

Yep - I've tried that. i.e. putting a Debug.Log just before every occasion where I call UITooltip.Hide(). It's not any of those.

It's like the tooltip itself has an automatic Hide() after 1 second. Obviously it doesn't. So something else is causing it.

Maybe the refreshing of the Panel or something else causes it?

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UITooltip.cs Disappears Very Quickly
« Reply #3 on: January 03, 2016, 05:16:43 PM »
Okay - narrowed it down further. The problem only seems to happen on my "sub-windows" - not on my main interface. All those windows are draggable, so I'm wondering if maybe that's the problem? Some sort of refresh that's happening on those windows which also clears the Tooltip?

See demo:

http://www.stevejarman.com/temp/ngui_tooltip.mp4

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITooltip.cs Disappears Very Quickly
« Reply #4 on: January 05, 2016, 06:54:32 AM »
Do you show the tooltip yourself as soon as you hover over an object? Seems to me that 1 second delay is NGUI's native OnTooltip code firing.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UITooltip.cs Disappears Very Quickly
« Reply #5 on: January 11, 2016, 11:23:33 PM »
Yes - I'm showing the tooltips when entering hover and removing them on hover out. Can I maybe disable that "native OnTooltip code"?

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: UITooltip.cs Disappears Very Quickly
« Reply #6 on: January 12, 2016, 01:23:07 AM »
How do you setup your tooltip?

Works for me:
  1. //Start or Awake
  2. UIEventListener.Get(someobject.gameObject).onTooltip += OnTooltip;
  3.  
  4. private void OnTooltip(GameObject go, bool state)
  5. {
  6.      go.transform.FindChild("Tooltip").GetComponent<UIPanel>().alpha = state ? 1 : 0;
  7. }
  8.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITooltip.cs Disappears Very Quickly
« Reply #7 on: January 13, 2016, 07:11:27 PM »
Question becomes is why you fire them yourself then. Why not just set the tooltip delay to 0, so it appears right away without any additional work?