Support => NGUI 3 Support => Topic started by: Markov on October 15, 2013, 05:33:59 AM
Title: UIButton.isEnabled strage behaviour
Post by: Markov on October 15, 2013, 05:33:59 AM
How do disable and enable UIButtons now? I need btn color to be disabled color, but now it's still normal. I'm used to disabling them like this(in 2.7x): nextButton.GetComponent<UIButton>().isEnabled = false;
And what I see now: (https://pp.vk.me/c312825/v312825274/4444/a5g_3EfqqmI.jpg)
Button switched off, but button's color still normal(not grey)
Title: Re: UIButton.isEnabled strage behaviour
Post by: macy on October 15, 2013, 06:44:14 PM
Title: Re: UIButton.isEnabled strage behaviour
Post by: Markov on October 15, 2013, 07:27:41 PM
Same effect :-[
Title: Re: UIButton.isEnabled strage behaviour
Post by: ArenMook on October 16, 2013, 02:23:10 AM
Disable its collider instead. There's a typo in isEnabled. It should be:
publicbool isEnabled
{
get
{
if(!enabled)returnfalse;
Collider col = collider;
return col && col.enabled;
}
set
{
Collider col = collider;
if(col !=null) col.enabled=value;
else enabled =value;
}
}
Title: Re: UIButton.isEnabled strage behaviour
Post by: Markov on October 16, 2013, 10:20:07 AM
Thanks. It works. But if I want to enable and disable buttons dynamicly it works only with UpdateColor(val, true) It will be very handy if you return back enable/disable behaviour as it was in 2.7x versions.
Title: Re: UIButton.isEnabled strage behaviour
Post by: ArenMook on October 16, 2013, 01:02:58 PM
I just had a second look at this, and I retract my previous statement. There is no typo, and how it is is intentional. Furthermore, it works perfectly fine with the following test script: