Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: uberwleiss on March 19, 2014, 06:04:27 AM
-
Hello,
I've Updated NGUI to the 3.5.4 r2 and i get the " 'UpdateColor' is not a member of 'UIButton' " eror.
I used to change the colors for buttons depending on whether the weapon is equipped, out of ammo, unequipped or locked. After changing colors for every state (hover, press etc), I'd call UpdateColor function so the color change is immediate. In the new NGUI, there's no UpdateColor function anymore in UIButton. How can I solve this problem as quickly as possible?
Thank you.
-
I've solved this by adding:
public void UpdateColor (bool shouldBeEnabled, bool immediate)
{
if (tweenTarget)
{
if (!mInitDone)
{
//mInitDone = true;
OnInit();
}
Color c = shouldBeEnabled ? defaultColor : disabledColor;
TweenColor tc = TweenColor.Begin(tweenTarget, 0.15f, c);
if (tc != null && immediate)
{
tc.value = c;
tc.enabled = false;
}
}
}
To the UIButton.cs
Do you think this is ok? I hope it will not cause some problems. So far it works great, just as it were.
-
There is no UpdateColor because there is now SetState(). Use that instead.
-
Had that same probleme too: tried the SetState() on a UIButton.
It does not appear in the completion. Seems protected :
Console error : UIButtonColor.SetState(UIButtonColor.State, bool)' is inaccessible due to its protection level
(on 3.5.5 and 3.5.7)
Any ideas/examples on syntax on a UIButton ? (not a UIButtonColor)
Thank you very much
-
Just make it public. I'll also make it public in the next update.