- Home /
Input.GetAxisRaw doesnt read Keyboardinput
Hello guys, thanks for helping in advance ;) cant find a solution for a relative simple problem, about combining two arrow keys while "isRunning" is true. (Game is a TopDown 2D RPG)
while the Right Arrow Key is pressed, he doesnt recognize the Down Arrow Key anymore. while the Left Arrow Key is pressed, he doesnt recognize the Up Arrow Key anymore.
vertInput stays at 0 in both cases.
it works while isRunning = false, and every other combination works even while it's true.
here's the code:
float vertInput, horzInput;
bool _isRunning, _isMoving;
void Update()
{
DetectInput();
Debug.Log(" horz " + horzInput + " vert " + vertInput);
}
void DetectInput()
{
vertInput = Input.GetAxisRaw("Vertical");
horzInput = Input.GetAxisRaw("Horizontal");
_isMoving = Input.GetButton("Vertical") || Input.GetButton("Horizontal");
_isRunning = Input.GetButton("Jump");
}
Answer by mnmwert · Aug 23, 2016 at 01:49 PM
Use
if(Input.GetKey(KeyCode.RightArrow))
{
}
well, im new but not that new :) this is unfortunately no viable solution
i just used the arrow keys as a filler. i NEED the vertInput and horzInput. I just cant understand, what makes it not spitting it out?
I believe it has something to do with the vertical/horizontal movement being used at the same time. but Unfortunately I do not normally use those so I can be of no help now. :(
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to set facing direction in my case? 1 Answer
Move 2D Sprite Horizontally With Mouse 1 Answer
How can I make the player step forward on mouse click? 2 Answers