- Home /
This question was
closed Oct 16, 2015 at 05:44 PM by
_kevinjulian for the following reason:
The question is answered, right answer was accepted
Question by
_kevinjulian · Oct 14, 2015 at 09:48 AM ·
uibuttonbugdouble-tap
IPointerClickHandler on mobile not working?
I have problem with IPointerClickHandler, everything works fine in editor, but on android device, eventData.clickCount value always return 1.
Am I do wrong? Or there is different with mobile device?
public class AvailableObj : MonoBehaviour, IPointerClickHandler {
public void OnPointerClick(PointerEventData eventData){
int tapCount;
tapCount = eventData.clickCount;
if (tapCount == 2){
//do something
}
}
}
Comment
Best Answer
Answer by _kevinjulian · Oct 16, 2015 at 05:50 PM
I solve this problem, i handle with eventData.clickTime
public void OnPointerClick(PointerEventData eventData){
float currentTimeClick = eventData.clickTime;
if(Mathf.Abs(currentTimeClick - lastTimeClick) < 0.75f){
//do something
}
lastTimeClick = currentTimeClick;
}
Excellent !!!! Even better than clickCount. Thank you ~~~~~!!!!