I’m making a unity cellular sport, I’ve a easy scene and a canvas with just a few buttons and these buttons have scripts that detect if the button was pressed and launched. Right here is the code for doing this:
public class InteractiveButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public void OnPointerDown(PointerEventData eventData)
{
//do one thing
}
public void OnPointerUp(PointerEventData eventData)
{
//do one thing
}
}
This works completely advantageous as when i press the button the down occasion will get triggered as anticipated, but when i preserve my finger pressed and drag my fingers off the bounds of the button and let go the OnPointerUp
technique nonetheless will get referred to as as if I let my finger go on the button.
So how can I detect if the participant lets exit of the buttons bounds?