hi,
when I use input system to get single axis or key it’s return value perfect but when I try use multi axis or key like this :
up + left => up + right => up + left
all the time i press up key suddenly one axis stop return value
is it my problem or it’s normal in unity?
if its normal think how can I solve it?
Keyboards are only designed to reliably detect two simultaneous keypresses, in general. For a lot of key combinations, they can detect more anyway, but for some combinations they can’t. For example, on my laptop, holding space and up-arrow at the same time leads to further presses on left-arrow and right-arrow not being detected. It’s also different on different keyboards.
Some keys are designed to be chorded - things like shift and ctrl keys - and they may work better in combination with other keys. Generally, though, there’s not a lot you can do other than pick different keys and try to find combinations that don’t conflict. But bear in mind that it is hardware-dependent.
Other than that, avoid gameplay that requires holding different keys down in combination, and let the user choose to use different keys (even if you don’t support remapping the keys, you could support WASD as well as arrow keys as well as IJKL, then the user can choose which set to use, or mix and match).
I am in beginning of side-scroll platform game and in this genre player should run and jump and when he go forward shoot something and etc so press different combination key is the need of this genre. I play some game but never saw the problem like this so i think my code or unity has some problem. I like know is it my problem or unity bug? and I heard some good side-scroll platform game build by unity and I like know this game how to solve this problem.
I checked it before start this thread and it logged same as vision of game.
do you checked it?
is it work correctly in your machine?
what u mean “this instance”?
what is your unity version?
Considering GetAxis returns an axis value based on the +A -D and +W -S why don’t you just remove all your if statements…
I’m not sure what your desired effect you’re looking for, however this would give you simple wasd movement
Your code will make you move in positive directions since you’re checking the Absolute value of your axis (so you dont go backwards… at all) and you don’t really need to check if your vertical/horizontal axis is 0 - if it was it wouldn’t effect your thranslation calculations (anything*0=0)
My Conclusion: You are only going forward and to the right… therefore you cannot move in any other direction which may make it look as if your keyboard isn’t working…
I tried your code in begging of my test and I saw the problem and change it to this. if you see in line 8 and 20 I check fHorizontal and fVertical and change value to 1 or -1 and if ( Mathf.Abs( fHorizontal ) > 0 ) as same as if(entity move) so my entity or gameobject cam move in all axis. and when player release key in some second game object move till GetAxis() return zero.