Hi,
Firstly : sorry for my english, it’s not my natural langage.
I don’t understand how the press and release input works.
How do i know in my handler function if i’m pressing or releasing my button ? For example, if i want to jump with space, and stop the jump by releasing space : how do i know in my handler Jump() if I’m pressing or releasing the input ? I know we can use a “context” as argument, but I don’t understand how that’s work… Should I use this context ? if yes, how do I do ? else what I need to use ?
There’s a change to how this works coming in the next package.
As of 0.1.2-preview, there’s no great way for this. Basically, it’s down to ReadValue() as @Elhimp mentions. Even PressInteraction or PressAndReleaseInteraction don’t really solve the problem.
As of the upcoming 0.1.3-preview, the default interaction model (i.e. when you have no interaction explicitly added to a binding) is changing. Where before, every value change resulted in a call on performed, now what happens is that started and then performed gets triggered when the control is being actuated and cancelled is triggered when the control stops being actuated. I.e. close to what @Baste describes.
So, going forward, this will be very simple. started and then performed when the button goes down and cancelled when the button goes up. And if you have the continuous flag on, you’ll get another performed every frame while the button is down. And works the same way regardless of the type of control. If you have a stick, for example, you’ll get a started and performed when the stick moves out of the deadzone and a cancelled when it moves back into it.