Input.GetButtonDown is not working

var inputfield : Canvas;

function Update() {
	if(Input.GetButtonDown("Console")) {
		Debug.Log("Button Down");
		//inputfield.enabled = !inputfield.enabled;
	}
}

Don’t show in console “Button down”, when i press a “Console” button.
But with GetButton it’s working perfectly.

Is this a physical keyboard button? If I recall correctly, there are some types of input devices that do not fire "ButtonDown" and "ButtonUp" events.

> Is this a physical keyboard button? Yep.

So, a couple of stupid "is it turned on" type questions. 1) Is this script extending MonoBehaviour? 2) Is this script attached to an active GameObject that exists in your scene? 3) Is "Console" defined in your input manager, with the appropriate Positive Button entered?

> 1) Is this script extending MonoBehaviour? Yes. >2) Is this script attached to an active GameObject that exists in your scene? Yes. >3) Is "Console" defined in your input manager, with the appropriate Positive Button entered? And yes.

If you put a Debug.Log("in update") outside of the if statement, do you see that show up in your debug log?

4 Answers

4

Wow. Problem is solved. Thanks everyone.
I think problem was type of a button. It was Joystick axis. When i change type to “Key or Mouse Button” it’s working perfectly

I have this exact issue (with getmousebuttonup(1)). Mines due to another code which uses the same function. Try checking other codes of yours which use the same function by disabling them, then pressing the “Console” button.

You may be able to find out which code is responsible for this issue (if it is the same problem as mine).

Nope. Still not working.

did you try all the standard methods like restarting unity or your pc?
also, you can try to change your keyboard

If it’s keys on keyboard use, GetKeyDown. I think GetButtonDown is for mouse and joysticks.

GetButtonDown is for keys that are predefined in the Input Manager

GetButtonDown uses for keyboard too. But fo ButtonDown we need to define buttons in IputManager.