As the documentation states, interactions are composed of 4 phases: ‘Waiting’, ‘Started’, ‘Performed’ and ‘Canceled’.
To read my inputs, I created functions that return if the pressed action is in its ‘performed’ phase. Example:
public bool GetJump()
{
return _playerInputActions.Player.Sprint.phase == InputActionPhase.Performed;
}
However, after I started playing with the interactions provided in the input action window (using their default parameter values), I noticed that most of them did not work at all, so I decided to debug every existing interaction using the following code:
private void Update()
{
Debug.Log("(Key: 0) DefaultAction Phase:" + _playerInputActions.Debug.DefaultAction.phase);
Debug.Log("(Key: 1) HoldAction Phase:" + _playerInputActions.Debug.HoldAction.phase);
Debug.Log("(Key: 2) MultiTapAction Phase:" + _playerInputActions.Debug.MultiTapAction.phase);
Debug.Log("(Key: 3) PressAction Phase:" + _playerInputActions.Debug.PressAction.phase);
Debug.Log("(Key: 4) SlowTapAction Phase:" + _playerInputActions.Debug.SlowTapAction.phase);
Debug.Log("(Key: 5) TapAction Phase:" + _playerInputActions.Debug.TapAction.phase);
}
As I suspected, the ‘performed’ phase was not being called for almost any interaction type. While debugging, I tried reaching every phase for every action (by holding, tapping and pressing each button at random intervals), but I noticed that none of the actions returned all of their phases. The least achieved phase was ‘cancelled’, which was not returned by any action:
Can someone explain me what is going on?