Quantcast
Channel: Questions in topic: "keyboard"
Viewing all articles
Browse latest Browse all 605

Input system looses keypress after a few frames

$
0
0
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 Callback method (hope this is the right term) private void OnEnable() { if(playerControls == null) { playerControls = new PlayerControls(); playerControls.PlayerMovement.Movement.performed += i => movementInput = i.ReadValue(); } 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 ![alt text][1] Here is a screenshot of the consol: ![alt text][2] 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 [1]: /storage/temp/185910-screen-inputactions.jpg [2]: /storage/temp/185911-console.png

Viewing all articles
Browse latest Browse all 605

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>