Author Topic: 3.5.7 UIButton possible bug? : 'normal color' is set by a UIWidget's alpha.  (Read 1441 times)

briangibson

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 26
    • View Profile
UIButton's 'Normal Color' is coupled to the UIWidget's 'alpha' property.
This means that if I do a TweenAlpha on a UIWidget that has a button on it, it uses whatever the color that was set before I hit play.
This is counterintuitive and seems an awful lot like a bug- but perhaps the suggested workaround is to not have a UIWidget and a UIButton on the same gameobject?

I.e.: there are two possible scenarios, and each behaves differently:
1) I set the Alpha property of the widget to 0, and hit play.
Run a TweenAlpha from code to trigger to a value of 1.
Hover over the button, and then hover away - the button will fade away to invisible.

2) I set the Alpha property of the widget to 1, and hit play.
Run a TweenAlpha from code to trigger a tween from 0 to a value of 1.
Hover over the button, hover away, nothing happens. this is to be expected.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Alpha is cumulative. If you want to tween alpha of something that also has its color tweened, then decouple them into a parent-child like so:

Widget (TweenAlpha)
- Sprite (TweenColor)