Author Topic: [Feature Request] UIButtonColor flag for turning off color tweening  (Read 4558 times)

nikescar

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
If this is acceptable behavior, I'm going to start posting changes I've made to scripts that I believe others will find useful with the hope that these would be included in future builds.

The first one is quite simple. Just a boolean to turn off UIButton color tweening (on press, hover, etc).

In the UIButtonColor script I added:
  1. /// <summary>
  2.     /// Whether or not the button gets its colors tweened
  3.     /// </summary>
  4.     public bool shouldTweenColors = true;

and used it in the SetState method:
  1. if (mState != state && shouldTweenColors)

In the UIButtonColorEditor I added:
  1. NGUIEditorTools.DrawProperty("Tween Colors?", serializedObject, "tweenColors");

This way I can use my own color tweening or, if I don't want to have to set all colors to White when I don't need color tweening at all.

(If posts like this are not wanted or needed, please let me know)


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Feature Request] UIButtonColor flag for turning off color tweening
« Reply #1 on: April 09, 2014, 03:55:45 AM »
But then what's the point of UIButtonColor? It's one thing that it's meant to do you're disabling. So why not just turn off the component instead?

Litherad

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: [Feature Request] UIButtonColor flag for turning off color tweening
« Reply #2 on: April 11, 2014, 02:39:05 AM »
I guess he means UIButton? If so, I agree. My reason for using Image Button was to not have the color tween. In our game we have an option for making the player set the GUI color, and that is reset everytime the button is activated. There are workarounds, but they are all quite elaborate. The easiest one, modifying the script, has to be redone on each NGUI update.