New Input System OnMouseDown() Alternative

I updated my game to the new Input System and now the functions like OnMouseDown, OnMouseUp, OnMouseEnter, etc… don’t work anymore. How can I get around this?

Make sure you have a an EventSystem with an InputSystemUIInputModule in the scene and a PhysicsRaycaster or Physics2DRaycaster on your Camera, and then use the IPointerClickHandler interface on the object with a collider on itself or its children:

 using UnityEngine;
 using UnityEngine.EventSystems;
 public class MyClass : MonoBehaviour, IPointerClickHandler {
    public void OnPointerClick (PointerEventData eventData)
        Debug.Log ("clicked");

On new Input system, create a new control scheme for keyboard and mouse (if you pretend to support some other input types).
Then create an action map and an action. set type to button and on binding, click “Listen”, then perform a right click and select it. Now, this is setup for onMouseDown right as it is… so you shouldn’t have any issue with that… for other types of interactions, on submenu “Interactions” click on sign “+” and on the new interaction panel, select “press” for holding and “Release only” for mouse release.

IMPORTANT NOTE: i had some issues with player input component, those interactions doesn’t work and overall has some problems… so the workaround i found is to subscribe to the event programmatically instead of using the playerInput component.
Hope this helps!