Button Problem

I’m using a joystick button for this

	void Update(){

		

		if(Input.GetButtonDown("Fire1")){

			Debug.Log("is down");

		}

		if(Input.GetButtonUp("Fire1")){

			Debug.Log("is up");

		}

		

	}

The problem is, it only executes once, then stops working?

any fix?

Ideas?

Update() is called every frame as long as the object the script is attached to is active. If Update() isn’t being called, either the script has been disabled or the object it’s attached to has been disabled/removed.

Neither of those has happened, as the scripts still working with other stuff.

It’s every time the button just executes once and then fails to work again.

Even as simple as this in update

if(Input.GetButton(“Fire1”)){

Debug.Log(“key down”);

}else if(Input.GetButtonUp(“Fire1”)){

Debug.Log(“key up”);

}

Calls both once then never again.

I don’t see how I’m doing anything wrong, is Unity just buggy with this?

Are you saying that Update() is being called every frame (and that you’ve confirmed that is definitely the case) but that the joystick button is only being detected the first time it is pressed? Can you post a complete script that demonstrates the problem (i.e a script that, if you create a new project, create a new script with that code, and attach it to an empty game object, will behave in this manner)?

Ok after hours of testing.

The button does get called, but print and debug.log were only being called once, for an unknown reason.

I still don’t don’t follow what you’re saying. What does ‘The button does get called,’ mean? Did you mean that Update() does get called, but that the calls to GetButton() and GetNuttonUp() always return false (i.e. fail to detect the button)? Or that Update() does get called and GetButtonDown() and GetButtonUp() both work correctly, but that Debug.Log() isn’t doing anything? If the latter, how did you determine that to be the case?

Again, I suggest creating a complete, stand-alone test case if you are still having trouble.

Turn off “collapse” in the Console window.