- Home /
The value of Input.GetAxis("Horizontal") gets stuck when Xbox controller is disconnected...
Hello everyone, big problem here with Unity 2018.1:
So my game can be controlled with either a keyboard or with an Xbox controller. I want to give my players the option to disconnect the xbox controller and continue playing with the keyboard if they wanted to, the problem is, if the player happens to disconnect the controller while still pushing the left stick in the X Axis, the value of Input.GetAxis("Horizontal") gets stuck and there is no way to get it back to zero unless the controller is reconnected.
I already tried with Input.ResetInputAxes(), this will indeed, cancel all button presses in the controller, but only returns Input.GetAxis("Horizontal") back to zero for one frame, after it, it returns to the value in which it was stuck on...
Is there any way for a disconnected controller to stop giving value to Input.GetAxis("Horizontal") ??
Thanks in advance!
Just realised the same thing happens in both axes, Horizontal and Vertical. Does nobody have any idea? This is driving me crazy :(
Im not sure but i think you can chek if there is any controller connected, so you can code different things when is connected and when is not
thanks for the comments... unfortunately knowing when the controller is disconnected wouldn't help me when using the Input.axes on menus (Eventsystem and the Standalone Input $$anonymous$$odule uses the axis that gets stuck)
Your answer
Follow this Question
Related Questions
Input for bluetooth controller? 0 Answers
Read analog stick input without using the Input Manager 1 Answer
Input Fields using an Xbox One Controller 0 Answers
360 Trigger Pressing both Triggers at the same time 1 Answer
How to have multiple types of controller input using the input manager 0 Answers