Search Unity

Feedback Many Unity based games unplayable due to defaulting to joystick when suitable joystick not available

Discussion in 'Editor & General Support' started by robert_unity16, Apr 7, 2019.

  1. robert_unity16

    robert_unity16

    Joined:
    Apr 7, 2019
    Posts:
    2
    I'm a flight sim enthusiast, and have a few joystick and joystick like devices connected to my PC.

    I do not have a Joypad, and don't really want one.

    There are several Unity based games that see my joysticks and falsely assume i have and wish to use a joypad.
    End result is that the games are unplayable.

    Examples include...
    Yet Another Zombie Defence HD
    Meeple Station (these guys might have somehow fixed it)
    Fallout Shelter
    FAR: Lone Sails
    ...and many many more i can't immediately recall.

    If i disconnect all of my joystick and joystick like devices the problem stops, however this is not a practical long term solution.

    I'm not sure if the issue is the engine, or with the developers in how they employ the engine.

    Would be great if Unity could fix the issue and/or educate devs about the issue.
    A short term fix would be to somehow have the option for unity ignore all joysticks.

    As things are now a massive number of Unity based games are unplayable.

    Reproduce the fault buy plugging in something similar to a Thrustmaster Warthog Joystick and Throttle combo and some rudder pedals.
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    It's a combination! It's for sure possible for us devs to fix your issue, but it's very, very clunky.

    The correct solution is to allow the user to specify in the options that they want to use mouse+keyboard instead of the controller. The menu should also always work with mouse/keyboard even if a different device is plugged in. All keys should always be rebindable. Making that, and making it work well takes a bit of time, but there's really no excuse for forcing users to plug out their hardware to make your game work.


    Longer explanation:
    In the current input setup, we have to get the name of the controller, and then make a guess based on if it can be used based on that. That's easy for eg. XBox controllers or whatnot.

    The problem is third party controllers. There's a lot of them, and their names are a bit random. If we get a name that we don't recognize, we shouldn't just refuse to use that as a controller, because then we'd be F***ing over people with third party gamepads. We could use some smart matching and say "it has joystick in it's name, we should probably not use it", but what if people want to use the joystick for playing our 2D platformer? That might be very relevant for people with disabilities that need to hack together some custom hardware setup for things to work.

    Unity's working on a new Input system now, which is more specific about what kind of controllers it uses. That might be a good thing - if I create binds specifically for gamepads, they won't kick in for your pedals. But that might again F*** over somebody with eg. no arms that are using pedals to control their games. So honestly I don't think it's ever correct to just straight up ignore your joystick. Maybe it shouldn't default to active?
     
    robert_unity16 likes this.
  3. robert_unity16

    robert_unity16

    Joined:
    Apr 7, 2019
    Posts:
    2
    Baste, a brilliant, well explained and well thought out reply.

    I posted this a few years back on these forums, the reply i got back then was 'Just unplug your stuff', and it really annoyed me. As you said it's not a solution.

    There are thousands in my situation with the same issue, some might not have even tied the issue to unity.

    Ultimately i think it's smart for unity to 'try' to use whatever it thinks is a sensible input device by default.
    Just would be nice to disable that when things don't go so well.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Even with the current input system, Unity does not prevent enabling both keyboard/mouse and joystick input at the same time. It would actually be rather difficult to do with Unity's input system going from what I remember the last time I made a game with joystick and keyboard/mouse controls. I'd bet money all those games you are having trouble with are using Rewired instead of Unity's input system. Rewired actually supports hot plugging of joysticks, and supports enabling/disabling joysticks and keyboard/mouse with just a line or 2 of code.

    I don't know if what you describe is Rewired's default behavior or not.

    As a work around, get a USB hub with power buttons for each port. Then when you don't want the joysticks available you just press the button to turn them off. No more unplugging joysticks, reaching around the back of your computer, etc. Just have the hub in easy reach.

    https://www.amazon.com/Sabrent-4-Port-Individual-Switches-HB-UM43/dp/B00JX1ZS5O
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    I'd bet money NONE of them use Rewired. If they did, they'd either just work (If using the HOTAS Template for his joystick) or the joysticks would be ignored (the default if not maps made for them). Rewired is designed to support any type of controller. Nothing is magic out of the box and just going to work with everything under the sun without some level of developer involvement. If the developer makes a mapping for the Gamepad Template, most gamepads will just work out of the box. If they don't, they won't. I can't force them to make one. Rewired isn't going to try to force anything into a Gamepad-shaped mold like so many systems out there do. If the developer doesn't make a map compatible with a particular joystick type like HOTAS, it will simply be ignored and the user will have to map it themselves -- provided the developer provided a way for the user to map their controls. Again, Rewired provides a brain-dead-easy solution out of the box for those that don't want spend any time making their own, but not all developers use it and not all developers make their own, regardless of what the documentation advises. Just like a game engine, an input system, or fire, it is completely up to the person who has it in their hands to use it for good, evil, frivolity, or simply nothing at all.
     
    Last edited: Apr 10, 2019
    valentin56610 likes this.
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    It's 100% on the developers. It doesn't matter what the engine provides or doesn't provide. It's up to the developer of the game to give their users the experience they want them to have. If that means they have to replace whole chunks of the engine to do so because it's not up to the task, so be it. It can be done. Unity is a game engine with a full C# scripting engine. It's extremely open-ended. If it doesn't do something the way you want it to, you can write your own systems to make it do what you want it to, or else you can buy off-the-shelf systems that do what you want. There have been extremely robust, ridiculously cheap input system packages that support every controller imaginable available for Unity for the last 5+ years.
     
    Last edited: Apr 10, 2019
  7. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Like you I also enjoy flight simulation and the associated flight simulation controllers. The entire reason I got on Rewired unity asset early on (back in 2014) because of the great support of flight simulation controllers. It certainly makes the developer life easier in that regard. Then especially if you go multi-platform (Windows/MAC/Linux) for flight controllers.

    But Rewired has been a solution for a long time since 2014 for all types of controllers. If you are look for flight simulation that supports more flight controllers out the box then any other solution.

    The one of the most important things for me is the Rewired developer has actually had hands on development work with 90% of the controllers on the list. This is more critical for flight controllers than any other controller type.

    Look at the huge list of supported controllers and then scroll down to the flight controllers section. Take a very close look at the great variety of controllers that Rewired supports.

    Check out the list of controllers here ...

    http://guavaman.com/projects/rewired/docs/SupportedControllers.html
     
    guavaman likes this.
  8. turkinolith

    turkinolith

    Joined:
    Jun 5, 2020
    Posts:
    3
    I also am a flight sim enthusiest and I just ran into this very same problem.

    I'm building a rail-shooter using the new input system and I kept wondering why when I press the button I configured for my ship to move around that it would briefly nudge in one direction then stop.

    Then I noticed the input device in the debugger was "Thrustmaster HOTAS Throttle", uh oh, exactly the problem I have with SOOO many games.

    Suffice to say, as soon as I turn "Auto-Switch" off, things auto-magically worked as I would have expected.

    So, what I think was going on is it sees that I have some analogue inputs coming in from the throttle.
    I leave the X & Y axis down at the bottom of their dentent, but not fully locked. So my guess is either ambient noise is coming through or it just sees a non 0 value and this is triggering the throttle to be constantly switched to as the active device.

    This is beyond aggravating, but a solution could be a flag to ignore axis inputs for auto-switch and only switch on button presses.
     
  9. AndreSmith

    AndreSmith

    Joined:
    Nov 17, 2019
    Posts:
    1

    So I did some checking. I am working with the Unity lego package and the character would spin when joystick
    was plugged in. The fix in this case was to go to Project setting > Input Manager and change all Horizontal and Vertical entries Joy Num Fields from "Get Motion from all Joysticks" To a joystick that you will never use. This worked for me. Good Luck.