I’m trying to use Input Delegates with buttons. I’m listening for PRESS and RELEASE events. This seems to work for the first click, but the input delegate is unresponsive after that. What am I doing wrong here?
private UIButton control;
// Use this for initialization
void Start () {
// Get a reference to our control script:
control = GetComponent(typeof(UIButton));
// Tell the control to call our method when it receives input:
control.AddInputDelegate(MyDelegate);
}
void MyDelegate(ref POINTER_INFO ptr)
{
if(ptr.evt == POINTER_INFO.INPUT_EVENT.PRESS) {
Debug.Log("PRESSED");
} else if((ptr.evt == POINTER_INFO.INPUT_EVENT.RELEASE)||(ptr.evt == POINTER_INFO.INPUT_EVENT.TAP)) {
Debug.Log("RELEASED");
}
}