Search Unity

Custom HID Setup

Discussion in 'Input System' started by Osteel, Nov 11, 2019.

  1. Osteel

    Osteel

    Joined:
    Jan 17, 2014
    Posts:
    59
    Hi everyone,

    We're currently working on a small project for an interactive booth which will make use of a flightstick for control which isn't being properly detected by the input system, so it seems we will need to set it up as a custom HID.

    From reading online, it looks like its possible to create a custom input device, but I'm not sure exactly how to go about that from reading the documentation. For example, where does the existing JSON exist in which you can modify to add your own devices? etc.
    https://docs.unity3d.com/Packages/c...nual/HowDoI.html#create-my-own-custom-devices

    Any help would be greatly appreciated! :D
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Would recommend starting here.
     
  3. Osteel

    Osteel

    Joined:
    Jan 17, 2014
    Posts:
    59
    Thanks Rene-Damm!

    That helped, and we were able to get our joystick recognized by the input system. However, it seems to be outputting odd values for the x/y axis. It's a bit hard to explain, but:

    1. The default value is 1 even though we've defined the
      normalizedZero = 0.5
    2. Left goes from 1 - 0, but ends prematurely (about 50% of the way)
    3. Right goes from -1 - 0, but ends prematurely (about 50% of the way)
    4. The same issue happens with Down/Up

    I should mention that by default, the joystick was attempting to use SBIT format. We've switched it to Byte just to "get it to work", but I wonder if that's playing into the issue? Regardless, it still throws these two errors when recompiling the editor:

    Could not re-recreate input device 'Thrustmaster, Inc. USB Game Controllers (HID)' with layout 'ThrustmasterJoystrickHID' and variants 'Default' after domain reload


    Exception: State format 'SBIT' is not supported as floating-point format


    Any insight would be great, thanks!