- Home /
Input system looses keypress after a few frames [BUG?]
Unity2020.3.17f1 , InputSystem 1.0.2 I track player movement with the input system package. With gamepad everything works as expected. When i use the keyboard it does not recognize the keypresses most of the time. When it does it passes the values correctly, but only for a couple of frames. then it somehow looses track of it. Maybe one of you can help me figure this out?
I use the C# method.
private void OnEnable()
{
if(playerControls == null)
{
playerControls = new PlayerControls();
playerControls.PlayerMovement.Movement.performed += i => movementInput = i.ReadValue<Vector2>();
}
playerControls.Enable();
}
and using it:
//Movement
horizontalMoveInput = movementInput.x;
verticalMoveInput = movementInput.y;
moveAmount = Mathf.Clamp01(Mathf.Abs(horizontalMoveInput)+Mathf.Abs(verticalMoveInput));
Debug.Log("x: " + movementInput.x+", y: " + movementInput.y + ", amount: " + moveAmount);
The Input Action itsself is a passthrough Vector2 Here is a screenshot of the consol:
As you can see ther values suddenly zero out allthough the key has been pressed. also it took a couple of presses, for the keypress to be recognized in the first place
Edit: when i use the other method (draging PlayerInput Component on to some gamoobject) and using unity Events, it seems to work just fine. So it likely is neither a hardware/driver issue, nor an issue with the code, as it works fine with other tests. I assume this is a bug then?!
Your answer
Follow this Question
Related Questions
Can § be used as input? 3 Answers
Issues with Input.inputString 2 Answers
Detect from which keyboard key was pressed and cancel event 0 Answers
Distribute terrain in zones 3 Answers
iPhoneKeyboard.Open cannot handle multiple entries. Is it a bug? 1 Answer