'continuous' actions fire at different rates
For example in a setup for Gamepad or Mouse and Keyboard I have
- action 'move' (continuous):
- keyboard composite WASD
- gamepad left stick
- action 'look' (continuous):
- mouse delta (normalized)
- gamepad right stick
the problem is that using keyboard and mouse, 'look' is performed far more frequently than 'move' when both of them are used. This means that when both move/look are used to perform similar actions (in my case move scene objects) they don't respond in the same way or at different speeds, which is unacceptable when e.g. a symmetric appearance is needed.
public override void OnMove(InputAction.CallbackContext context)
{
if (!context.performed)
return;
var move = context.ReadValue<Vector2>();
Debug.LogFormat("move: {0}", move);
// update a value based on 'move'
}
public override void OnLook(InputAction.CallbackContext context)
{
if (!context.performed)
return;
var move = context.ReadValue<Vector2>();
Debug.LogFormat("look: {0}", move);
// update a value based on 'move'
}
I would have expected 'continuous' actions to fire at a fixed rate, like once per frame. The only solution in user code that I can see right now is to store the last move vectors in member variables and do the actual input handling in one of the Update()s.
"Continuous" means the action would trigger every Update, which does not happen in a fixed time span. Please try our forum for the Input System. You may get more help from the community there: https://forum.unity.com/forums/new-input-system.103/
@JiaUnity it would be fine like that, but it's not really what happens: if i move my mouse for action A and press keys for composite action B at the same time l, then, even though both actions are composite actions, the action A callback is called more frequently (with performed set to true) than action B.
Hey, sorry for the late response, but here is an explanation what is going on.
So for mouse delta, the "Performed" is triggered when the value is not (0,0). For keyboard keys, the "Performed" is triggered when the value switch from 0 to 1. And when "Continuous" is selected, every frame there is a reading for the value, and the result decides if the "Performed" is triggered for this frame.
However, this is on top of the other "Performed" that's triggered between frames. They are queued in the background, and only get resolved for each frame. And as you can image, the mouse delta changes much more frequent than key press, and thus has more "Performed" triggered. This is expected.
The method you mentioned yourself is a good way to make sure they sync at the same time. I'd recommend the forum again, and see if community has a better way to do this.
This can be closed since continuous actions have been removed as a feature.