Hopefully this is a simple question. In my input reader, I have a method that is called when the player enters a room, there is a small transition so I want to disable the player control of the character. The way I’m doing this is to disable the the action map for the player, and then when enabling it, I’m double checking the UI “pause” is not enabled and giving the player control again.
public void EnablePlayerControl() {
if (!_inputActions.UI.enabled) {
_inputActions.Player.Enable();
}
}
public void DisablePlayerControl() {
if (_inputActions.Player.enabled) {
_inputActions.Player.Disable();
}
}
My issue is, that if I have a button held down such as “Target” that is I want my player to strafe while held down, the state is loss. It doesn’t appear that public void OnTarget(InputAction.CallbackContext context){};
is called when the action map is enabled so it doesn’t know the state.
What is the right way of doing this? Essentially I want to invoke TargetSilently action during EnablePlayerControl if the button is still held down, as in to not trigger my Target call as if the button was pressed down. Or am I doing this all wrong?