I’m a new developer and I can’t seem to find why I can never get any button input. GetAxis works fine but Ive tried using it in 2d and 3d. GetButton and GetKey, It just doesn’t work. I’m following tutorials and every single one fails as soon as they use GetKey or GetButton. I’m so lost I have no clue what is going on.
I dont’t know the detail of your project so I can’t say the solution…
but one possible reason is that you might use multiple canvas or images.
Other canvas or image close to the button may interfere your interaction(click the button).
In this case, delete other canvas or uncheck “Raycast Target” in Image component.
Hope it will help you
Bro what is going on here
Unsure if this is the answer, but im this is the only thing I can think of for GetButton and GetKey. Can we see the script? Is it in Update()? If you for example don’t put it in update and lets say put it in start that means you need to click said key at the same frame as the game starts. you should do something like (script) from my knowledge. Also the “KeyHere” should not have quotation marks normally, thats just the name of the key, so for example if you want to have it happen on clicking space you do if (Input.GetKeyDown(KeyCode.Space)) { }
.
private void Update()
{
if (Input.GetKeyDown(KeyCode."KeyHere"))
{
// Actions upon clicking said key
}
}