• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by el-RERS · Jul 03, 2018 at 06:52 AM · inputcontrolleraxisxboxhorizontal

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!

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image el-RERS · Jul 06, 2018 at 06:43 AM 0
Share

Just realised the same thing happens in both axes, Horizontal and Vertical. Does nobody have any idea? This is driving me crazy :(

avatar image hexagonius · Jul 06, 2018 at 07:13 AM 0
Share

Sounds like a bug to me, you should report it.

avatar image tormentoarmagedoom · Jul 06, 2018 at 10:03 AM 0
Share

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

avatar image el-RERS · Jul 06, 2018 at 04:12 PM 0
Share

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)

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

109 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Input for bluetooth controller? 0 Answers

360 Trigger Pressing both Triggers at the same time 1 Answer

Controller Joystick Hold Delay Logic? 1 Answer

Gamepads/Controllers and the Unity Editor 2 Answers

Read analog stick input without using the Input Manager 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges