Author Topic: Button Highlight Question  (Read 6685 times)

moonface

  • Guest
Button Highlight Question
« on: April 16, 2012, 08:47:51 AM »
Hi,

I'm using NGUI and it is vey good, but am having one slight difficulty and would appreciate some pointers.

When I use the UIButtonTween script to move between two menus (menu1 and menu2) by pressing a button, everything works as expected and I can move from menu1 to menu2 and vice versa.

The difficulty however is that the button on menu1 (being pressed - the one activating UIButtonTween) seems to retain its state. When pressed it expands slightly and turns green (as it should) but when return to menu1 from menu2, it is still green and expanded. I can press it again and move between the menus but it seems to permanently remain in the same state. I am only using UIButtonTween and not animating buttons changes.

I am disabling the button after the message and OnDisable is being called in the UIColorButton script.

Is there anything I have missed out?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button Highlight Question
« Reply #1 on: April 16, 2012, 09:45:47 AM »
Are you using NGUI Free? This issue was fixed in the standard version of NGUI a long time ago as far as I know.

moonface

  • Guest
Re: Button Highlight Question
« Reply #2 on: April 16, 2012, 09:55:09 AM »
No. I'm using the bought version (latest I assume as I bought it yesterday).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button Highlight Question
« Reply #3 on: April 16, 2012, 09:58:41 AM »
Technically no, there was an update overnight -- 2.0.1 is the latest. Do you instantly enable / disable entire windows, or is there a gradual animation?
« Last Edit: April 16, 2012, 10:03:03 AM by ArenMook »

moonface

  • Guest
Re: Button Highlight Question
« Reply #4 on: April 16, 2012, 10:01:50 AM »
I'm instantly updating windows at the panel level.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button Highlight Question
« Reply #5 on: April 16, 2012, 10:03:20 AM »
I'll see if I can reproduce it later today.

moonface

  • Guest
Re: Button Highlight Question
« Reply #6 on: April 16, 2012, 10:10:54 AM »
Many Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button Highlight Question
« Reply #7 on: April 16, 2012, 10:28:14 AM »
Ok, I see what's happening... it's a matter of which script gets executed first. If your script that activates the panels gets the event first, OnHover messages won't be received because SendMessage doesn't work on deactivated game object. I'll see if I can figure out an elegant solution.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button Highlight Question
« Reply #8 on: April 16, 2012, 11:17:45 AM »
I've coded a fix... but I feel it needs more testing before I release it (just to make sure it doesn't break anything else).

moonface

  • Guest
Re: Button Highlight Question
« Reply #9 on: April 17, 2012, 06:40:07 AM »
Cool. Look forward to trying it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button Highlight Question
« Reply #10 on: April 17, 2012, 06:04:46 PM »
The fix was a part of 2.0.2

moonface

  • Guest
Re: Button Highlight Question
« Reply #11 on: April 18, 2012, 07:37:06 AM »
Thanks, this fixes it.

I did notice for anyone else in this situation, or is it a feature  ;) that the order in which the tweening scripts are executed is important. The script moving towards the new menu must precede the script removing the old.

Cheers.