Hello, the documentation is pretty clear on how to add a callback for an InputAction phase with :
var action = new InputAction();
action.started += ctx => /* Action was started */;
action.performed += ctx => /* Action was performed */;
action.canceled += ctx => /* Action was canceled */;
However, I didn’t find anything related to removing a callback. I tried with this
action.started -= ctx => /* Action was started */;
I ran into this same issue since all of the resources I was looking at was telling me to subscribe it how Shashimee posted above.
After reading the Microsoft API for subscribing events, it would appear the difference is between using an anonymous function (Shashimee’s post) which would require delegates to swap the callback reference and using a properly subscribed event. You can’t unsubscribe an anonymous function.
I wanted to post this in the event anyone else is running into the issue, definitely take Lurking-Ninja’s approach!