Hey,
Currently working on upgrading a project and looking to import the new input system.
The automatic update worked great for general UI interaction etc in the app but I’m wondering how I’d go about porting functionality from UI elements that implement IPointerDownHandler and IPointerUpHandler to Unity’s enhanced touch api OnFingerDown and OnFingerUp as we’d like to be able to get increased accuracy of the touch times from the Finger class provided.
For example we’d have:
public class FireButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public void OnPointerDown(PointerEventData eventData)
{
//get touch time
// do stuff
}
public void OnPointerUp(PointerEventData eventData)
{
//get lift time
}
}
And then in the updated class I have something like below:
public class FireButton : MonoBehaviour
{
public void OnFingerDown(Finger finger)
{
//get touch time
// do stuff
}
public void OnFingerUp(Finger finger)
{
//get lift time
}
private void Start()
{
UnityEngine.InputSystem.EnhancedTouch.Touch.onFingerDown += OnFingerDown;
UnityEngine.InputSystem.EnhancedTouch.Touch.onFingerUp += OnFingerUp;
}
}
I’ve enabled TouchSimulation so I can try and test in editor but can’t get any reaction out of the events above, feel like I’m missing a step. Any help would be most appreciated!