Hey,
I am experimenting with NGUI, and I have two issues.
First, I am trying to create a virtual button. If the button is held down, the player should move forward, and if the button is released, the player should stop.
I have tried it in the following way:
function OnPress ()
{
pController.goUp = true;
}
function OnRelease()
{
pController.goUp = false;
}
Secondly, I want my buttons to work in the following way:
When I click on the button, the tween effects should play from start to finish. But instead, if I release th button, the tween effects stops as well. To counter this, I have created a custom script:
function OnClick()
{
tweenColor.enabled = true;
tweenScale.enabled = true;
yield WaitForSeconds(0.4);
tweenColor.enabled = false;
tweenScale.enabled = false;
label.color = Color.white;
this.transform.localScale = Vector3(1, 1, 1);
}
But with this script, the tweens start to "break" after a few clicks.
Is there any solutions for my problems?
Thanks!