Support => NGUI 3 Support => Topic started by: TypoStraw on July 29, 2014, 08:18:23 AM
Title: Bug in UIButtonColor when dragging
Post by: TypoStraw on July 29, 2014, 08:18:23 AM
I have a couple of buttons set up with a UIButton and UIButtonColor that will invert colors when pressed (http://i.imgur.com/bPZbD2F.png)
If I press and hold on one of the buttons, and move the mouse over a different button, the new button label will change color to the pressed state and thereby hide the label (white text on white background).
Here's a video of it in action: http://gfycat.com/InstructiveSandyDragonfly
If I instead of UIButtonColor use UIButton, it works just fine, since it has some extra checks in the OnDragOver method (line 225):
Title: Re: Bug in UIButtonColor when dragging
Post by: TypoStraw on July 30, 2014, 09:45:22 AM
Yeap, however, it won't be a good fix for everybody since the dragHighlight variable in UIButton won't be usable.
Title: Re: Bug in UIButtonColor when dragging
Post by: ArenMook on July 30, 2014, 10:57:59 AM
dragHighlight is an option for the button, so not sure why this would matter in your case? To be honest, there is little reason to use UIButtonColor at all, and it even prompts you to update it to UIButton when you try to use it. UIButtonColor is only kept for backwards compatibility purposes.
Title: Re: Bug in UIButtonColor when dragging
Post by: TypoStraw on July 30, 2014, 11:09:53 AM
Ah kay, just figured I'd use UIButtonColor in this case since I only needed the color change and not the rest of the UIButton functionality.
The dragHighlight variable doesn't matter for me, I was just thinking about it generally. The reason I state that it won't fix it for everybody is because of line 225 of UIButton.
If dragHighlight is true but the pressed object isn't gameObject, it would still activate the base.OnDragOver, but since I copied the gameObject check the method will just stop there - dragHighlight would have no effect.
Title: Re: Bug in UIButtonColor when dragging
Post by: ArenMook on July 30, 2014, 11:17:17 AM