- Home /
Xbox Controller and Input.GetButtonDown( );
Hey there,
I've searched around for this problem and couldn't find anything on this particular issue so sorry for a dupe if this is one.
However, in our game when getting the controller input everything works perfectly as long as the method is Input.GetButton. However, if the method is changed to Input.GetButtonDown() it suddenly stops working.
As sample of our code:
public void Update( )
{
bool test = Input.GetButtonDown( "EBrake_1" );
if( test )
{
Debug.Log( "Get Key Working" );
}
}
And the working code:
public void Update( )
{
bool test = Input.GetButton( "EBrake_1" );
if( test )
{
Debug.Log( "Get Key Working" );
}
}
I'm not too sure what the issue is, I've tried storing them in variables, calling them directly, etc. The only thing I can think of is that the GetButtonDown method doesn't work with xbox one controller.
$$anonymous$$ake two boolean variables set to false.
On the first frame Button is detected make the A boolean true.
Detect this condition, including that the other, B, is false.
After this make B = A;
Answer by screenname_taken · Aug 13, 2014 at 03:44 PM
http://wiki.unity3d.com/index.php?title=Xbox360Controller
And use Input.GetKeyDown("joystick button 0")
Yea that works fine, I'll just use that. But it does bother me a bit that the GetButtonDown doesn't work? Seems like a bug in Unity itself? In any case we will just use that. Thank you!
Answer by 10yaseen1 · Jul 11, 2016 at 07:33 PM
Probably too late to reply, but I just tried changing my Input in input Manager to "Key or Mouse Button" instead of "Joystick Axis" and it works like a charm. :D
Well you just saved my life, I just went crazy because it worked with controller 1 and 2 but not with 3
Answer by ardiawanbagusharisa · Jan 30, 2018 at 06:38 AM
if anyone still has the same problem just follow this wiki http://wiki.unity3d.com/index.php?title=Xbox360Controller edit > project settings > input > then follow the instructions from the site.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
PAD Xbox 360 0 Answers
Pad Controller xbox360 - triggers 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers