This works great, but I get:
NullReferenceException: Object reference not set to an instance of an object
UIButtonColor.OnPress (Boolean isPressed) (at Assets/NGUI/Scripts/Interaction/UIButtonColor.cs:158)
UIButton.OnPress (Boolean isPressed) (at Assets/NGUI/Scripts/Interaction/UIButton.cs:90)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
RightArrowButton:Update() (at Assets/MyScripts/RightArrowButton.cs:36)
On the KeyUp because the currentTouch.current is not set in:
protected virtual void OnPress (bool isPressed)
{
if (enabled)
{
if (!mStarted) Start();
if (isPressed)
{
TweenColor.Begin(tweenTarget, duration, pressed);
}
else if (UICamera.currentTouch.current == gameObject && UICamera.currentScheme == UICamera.ControlScheme.Controller)
{
TweenColor.Begin(tweenTarget, duration, hover);
}
else TweenColor.Begin(tweenTarget, duration, mColor);
}
}
What is best way to fix?