I'm using XInputDotNetPure libary for Xbox controller on unity.
it seems that if I do that code:
state = XInputDotNetPure.GamePad.GetState(playerIndex);
if(state.Buttons.A == XInputDotNetPure.ButtonState.Pressed)
it will return true every frame that button is pressed, and I am looking something of a "if(buttonDOWN)" functinality - that means, something that returns true only on a single ( first) frame the button is pressed.
A little late to the party, but try something like this:
public bool GetButtonDown()
{
//Don't want to spam the button press, so we limit it to downCount <= 1
//so that it will act like Input.GetKeyDown
if ( downCount>= 1 )
return false;
downCount += 1;
return bDown;
}
“downCount” is a globally defined variable and “bDown” is whatever the button is. In your case, it’d be “state.Buttons.A == XInputDotNetPure.ButtonState.Pressed”