Support => NGUI 3 Support => Topic started by: tnbao91original on June 04, 2014, 03:01:27 AM
Title: How to detect when un press a button ?
Post by: tnbao91original on June 04, 2014, 03:01:27 AM
OnPress method only run 2 time when i press and unpress a button. I put a log in OnPress method and it show me 2 time but how can i detect when i unpress ? Any method OnUnPress ?
Title: Re: How to detect when un press a button ?
Post by: Nicki on June 04, 2014, 05:14:12 AM
OnPress has a bool as parameter.
void OnPress(bool pressed)
{
if(pressed){
Debug.Log("You pressed down on "+ gameobject.name, gameobject)
}
else{
Debug.Log("You released on "+ gameobject.name, gameobject)
}
}
Title: Re: How to detect when un press a button ?
Post by: tnbao91original on June 04, 2014, 10:30:09 AM
Solved, thank you for support :)
Title: Re: How to detect when un press a button ?
Post by: Darkmax on June 04, 2014, 12:57:42 PM
Also you can use OnClick() method this is called when your button is released