Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

Simple Hotas setup not so simple

Discussion in 'Input System' started by RedRiverStudio, May 10, 2021.

  1. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    130
    Hello, I have moved to the new input system. A single controller reads and binds fine. If I add another input device, like a throttle matched to a joystick, the 2 battle for inputs and nothing gets done. How do we get multiple devices to act as one coherent system for a single player?

    I have set up my input system as a singleton input wrapper to contain the InputSystem and XR input as one. This has a list of actions

    Code (CSharp):
    1.  
    2. private void Start() {
    3.           pa_Boost = instance.pu1.currentActionMap.FindAction("Boost",true);
    4. }
    I then ask the input wrapper to query an input:

    Code (CSharp):
    1.  public static bool b_Boost() {
    2.         return instance.virtualBoost ? true : instance.pa_Boost.ReadValue<float>() > 0;
    3.     }
    works fine.

    I see that I have to add multiple Input Systems to soak up extra devices. If I create 4 input systems attached to the singleton, the debugger says: user 0) keyboard 1)Joystick 2)Throttle. Progress?

    Only user 0 has actions mapped to anything, user 1 and 2 are dead on arrival. What do I do? Do I clone actions? Can I create multiple pairings for just 1 user instead? I only want one short list of inputs actions that I want multiple devices to be able to concurrently communicate with.

    Thanks.
     
    Last edited: May 10, 2021
  2. jukibom

    jukibom

    Joined:
    Aug 31, 2015
    Posts:
    36
    Hah, this is funny. I was going to get in touch with you - I'm having flight stick problems and some of my early test users are reporting similar problems with Vector 36 since the last update (which I just bought like an hour ago to have a play around in, looks awesome by the way!). I thought you used rewired, doesn't that use the old system?

    One thing I don't have a problem with however is devices fighting each other (when they work at all). You should be able to pair any device with a single user by iterating over them as I mention in here https://forum.unity.com/threads/cer...ised-for-rebind-but-no-input-in-game.1107347/

    I also found setting the Action Type to "Value" rather then "Pass Through" prevented multiple bindings of the same action from trampling over each other. I also disregarded the multiple control schemes and made a custom "Everything" scheme to attach all actions to - this is because I specifically don't want unity to try and switch around which devices are active as flight sim people tend to mix and match.

    If you wanna chat about any of this stuff hit me up as it seems we have similar goals and problems :p
     
    Last edited: May 10, 2021
  3. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    130
    Hi Jukibom, yes it has been a bit of rollercoaster trying to get this input system to behave as expected. I was using Rewired quite successfully, but Guavaman didn't sound like he was that interested in supporting XR inputs, and trying to create custom devices to recognize all the incoming hardware was just too much. I wanted a Unity supported and more generic input system that natively supported XR. Unity had a new solution that was updated along with the engine, so I went all in. Unfortunately, now that it is fully integrated and the new build is out, I am seeing all sorts of bizarre and unintuitive behaviors. One of which is (apparently unique to me) conflicting controllers.

    I think the fighting has to do with the auto switch function offered in PlayerInput, turning it off just means you have to move it over to a new scheme manually, which has its own problems. I have all my actions set as value, mostly because I didnt know what pass-through meant at the time. I really like your idea of making a generic everything scheme for exactly the reason you describe: simulation players use everything as an input. I have some players with up to 4 different devices for a single player. I might take a shot at that and report back.

    As far as your comment about working at all: You may already know this, but if your controllers arent even responding, it may be related to the maximum input allowances I am facing. I had players report that their controllers weren't working until they turn off their XR controllers. Even XR controllers, resting on a table, on the other side of your computer, will register as an input and cancel other controllers. Only if you physically turned off the XR controllers would something like a joystick register.

    I would love to see what you are working on and very happy to commiserate I mean chat about these issues. Find me on discord at RyanM#9138 or here is fine.
     
    jukibom likes this.
unityunity