I am having issues with getting any input functions to recognize input from the space bar. I used something like this initially:
void Update()
{
// Spacebar isn't getting picked up by getButtonDown?
if (Input.GetButtonDown("Jump")) {
Debug.Log("jumped");
shouldJump = true;
} else {
shouldJump = false;
}
}
The project is setup to have space as a jump button. I added the 'e' key as well, which works. So the issue doesn't seem to be related to logic. So it is not an issue with the 'Jump' input request.
Next I tried just getting the space button itself:
void Update()
{
// Spacebar isn't getting picked up by getButtonDown?
if (Input.GetKey(KeyCode.Space)) {
Debug.Log("jumped");
shouldJump = true;
} else {
shouldJump = false;
}
}
This also didn't work. So, after that I just set it that any button will print to the debug console:
void Update()
{
if (Input.anyKey) {
Debug.Log("Pressed ");
}
}
This one actually does print when the space bar is pressed. So I know space is working, I'm just not sure why the other functions aren't recognizing it as a valid input.
I am on Ubuntu 18.04 using 2019.4.5 LTS.
↧