Hi,
I’m hoping for some guidance. I’m using the new input system. In this case, I’m trying to leverage the Action Map approach instead of hard scripting my input logic.
i currently have some basic actions setup for a platformer style game.
In this game, the player can jump. (Typical platformer ability)
The challenge:
- The OnJump event fires when the player presses the jump button.
- The OnJump event can also be configured to fire when the jump button is released.
Multiple frames can happen between these events. Is there any way to evaluate Jump between these events to tell that Jump was not pushed “This frame” and thus any bool isJumpPressed can be reset the frame after OnJump was called the first time?
Hit the + interactions, then add a Press interaction. You can then get Press, release, or both
The challenge, and perhaps im missing some detail, is I need to know when the button is not yet released but was NOT freshly pressed this frame.
You should get 3 “states” on the callback : started, performed, and canceled. If you got started (the frame it was pressed) but not performed yet, you’re “holding down”. Or simply set a flag to true on press, and false on release.
But I don’t even know if you need to know that if I understand your first message correctly. Have both press and release on the action, and then you can call your Jump() method based on what you want to do ?
If you set the Press interaction @Jichaels suggests to “Press and Release”, you should be getting what you’re looking for I think. “Press and Release” will perform the action when the button is pressed and when the button is released. How many frames elapse in between (including none at all) doesn’t factor into the callback sequence.
Alternatively, you can go without the Press interaction and just use the default behavior. In this case, you will get a call on started when the button is pressed and a call on canceled when the button is released. You may still get multiple calls on performed if it’s bound to, say, a trigger on the gamepad but you will only get one call on started and one call on canceled.