void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log(“Up Arrow key was pressed.”);
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log(“Down Arrow key was pressed.”);
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log(“You hit enter.”);
}
}
}
this is the code i have but it still let me hit all 3 buttons at once what am i missing?
I was having the same issue and tried adding this to my code and all it did was add a frame counter to the “button pressed” output. it is still allowing me to press 2 buttons at the same time.
Not to Highjack this thread… but I am having the same issue. I followed the advice above, by adding the Time.frameCount + to my code… but it does not seem to have done anything. The first attempt at multi button press it stops it, but after that it still allows me to press 2 or 3 buttons simulataneously.
(Edit: note- I originally was using H & L, as my input, but when I could still press multiple buttons I changed it just to make sure it wasn’t the buttons I was using. That is why the text say L and H, in the instructions.)
After further searching I found two answers to my question (for anyone interested)…
The first and most pertinent: The frame numbers added (with Time.frameCount) show in fact it is a speed issue, and not a coding issue. So if youre having this issue, look at the frame numbers in the console…