Search Unity

Steam Controller API support

Discussion in 'Input System' started by Rene-Damm, Aug 11, 2018.

  1. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Needing a breather from bugs and intricate input state machinery details, I decided to tackle something more on the fun side as my Friday project. Steam input integration has long been on the list of things we'd like to have but on the roadmap it firmly landed on the >1.0 side. But anyway, I decided to experiment a bit with that.

    First off, shout if it's something of interest to you. The louder, the better :)

    So, the Steam input stuff is interesting in that it severs the tie between actions and bindings and leaves only the actions with the game while moving the bindings into the Steam runtime. Means Valve can do some really neat stuff with user rebinding in the Steam client.

    The way I picture supporting this is by enabling two workflows. One of simply surfacing Steam input as a Unity input device. And another of going all the way to connecting Steam input actions to Unity input actions. In the first workflow, Steam simply becomes another input backend and you can work with it like with any other input device. In the second workflow, you can go one step further and write input code that looks the same for the Steam version of your game as it does for versions targeting other platforms.

    So, today I prototyped some ways to support both workflows.

    First, I added the ability to export a Unity .inputactions file to a Steam In-Game Actions (IGA) file:



    This results in a .vdf file being generated which can then be used with Steam to tell it about the actions that your game supports.

    Next, if you have a .vdf file (either generated with the functionality above or something you have authored directly), you can generate a Unity device layout directly from the file:



    This will generate a Unity input device implemented in C# that represents your game-specific controller as it appears through the Steam API:



    Other than this appearing as a native input device, it also allows setting up bindings on the custom, game-specific Steam controller:



    This way, Unity input actions will bind to Steam input actions and Steam input will appear on them like from any other device input.

    ATM this isn't much more than Friday work and I still have to implement the part where... you know... it actually picks up the input from Steam but yeah, thought I'd just share this for the heck of it :)
     
  2. dri_richard

    dri_richard

    Joined:
    Mar 10, 2017
    Posts:
    153
    We had some problems with Steam VR controllers recently. With the current input system, if the user (somehow) minimises the game window, we stop receiving input through the Input Manager. Unlike a non-VR game, the game can continue to be played as it's still rendered in the headset.

    This is an edge case, but something our QA team reported. We work around it by using the Steam VR & Oculus input APIs directly - will the new input system help this?
     
  3. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    Hello,
    The new input system will not specifically fix this, but this is in my wheelhouse, and I don't think that should happen. I'll make sure it's fixed both in the new and old input systems.

    Going to dig out the bug and see what I can do. Do you have any more info on the ticket on hand?
     
    Vaupell likes this.
  4. dri_richard

    dri_richard

    Joined:
    Mar 10, 2017
    Posts:
    153
    Unfortunately not, and in fact I was just working on our bug and I think I'm mistaken (in some ways).

    Our Steam VR builds support VR controllers and the Xbox gamepad. Vive controllers continue to function when the game window is minimised, but Xbox controllers do not (this is using the Input Manager). If SteamVR_Controller supported Xbox controllers I'd happily switch to using that. It looks like I'm going to have to use different APIs depending on the controller type detected.
     
  5. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    Ah, that's less in my domain if it's not with the VR devices specifically. I'll still dig in, it's really valuable to be able to allow input without focus or display, as you are finding out.
     
  6. DMariscal

    DMariscal

    Joined:
    Feb 2, 2017
    Posts:
    5
    Any more updates on this? I'd be really interested in seeing its progress, in the meantime I might give this option a go: https://www.equalpasta.com/2017/06/15/steam-controller-with-unity/ as I really need some steam controller support within unity :)
     
  7. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    The frontend stuff is relatively complete but there still remains some work to be done on the internals to hook it up fully. My hope is we can get it done in time for 1.0-preview. It's not a whole lot of work that's left.
     
  8. DMariscal

    DMariscal

    Joined:
    Feb 2, 2017
    Posts:
    5
    Thanks for the update, great to know there is not much left to do :)
     
  9. bleachisback

    bleachisback

    Joined:
    Jan 22, 2019
    Posts:
    2
    Would this also work with Steam's VR controller bindings? Right now if you use the SteamVR 2.0 with the Input System beta, SteamVR's input manager completely overrides the new Input System, causing actions not to trigger anymore.
     
  10. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    I'm not really familiar with the Stream VR stuff (someone from the XR team would have to chime in; @StayTalm_Unity?) but my guess is that it wouldn't. At least at this point. The integration is tied to the Steam Controller API which, to the best of my knowledge, is restricted to gamepads and the Steam controller.

    Ok curious about that. Wondering what SteamVR is doing. Is it just VR input going silent in the new input system or does any input (even keyboard etc) stop reporting anything?
     
  11. bleachisback

    bleachisback

    Joined:
    Jan 22, 2019
    Posts:
    2
    I went back in and tested it. It seems to just be the VR input (I've only tested that with the Vive wands specifically because that's what I have access to).
     
  12. Meepo0

    Meepo0

    Joined:
    Nov 24, 2017
    Posts:
    31
    Does the gamepad option in new input system support the steam controller as well?
     
  13. Saucyminator

    Saucyminator

    Joined:
    Nov 23, 2015
    Posts:
    61
    Sorry for asking, is there any way to get Steam Controller to work with InputSystem as it is right now?
     
  14. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Unfortunately not yet. We have partially completed support but it didn't make it to the finish line for 1.0. The key pieces are all in place (VDF conversion and interface to Steam Controller API) and the intention is to finish this after 1.0. Just for 1.0, time ran out and other stuff was shouting for attention.
     
  15. Hysparions

    Hysparions

    Joined:
    Jan 7, 2019
    Posts:
    29
    Excuse me,
    I had a few headaches with input system. I tried to use switch pro controller from power A & DualShock4 with steam opened, and it seems that they modify the HID of the gamepad, which causes aberrant values for input inside debug view. It is absolutely impossible for me to use one of my game pad for unity. Do you heard similar problems on the net? couldn't find other similar issues, but steam is a big platform...
     
    Pawciu likes this.
  16. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    Having Steam Controller support would make me so happy.
    It would make my life easier to have greater controller support, and Steam is an excellent platform to consider for my game.

    Thanks for attempting this, probably was pretty challenging! Goodluck in completing it.
     
  17. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    903
    So what is the state of supporting steam input API with the Unity input system today? Especially with the impending release of Steam Deck, this is becoming an even more hot topic.

    @Rene-Damm did your Friday work ever make it into the real product? ;-)
     
    Vaupell and david-wtf like this.
  18. kyubuns

    kyubuns

    Joined:
    Aug 6, 2013
    Posts:
    138
    If you go through Steam Input, even the information about whether it is PlayStationController or XboxController that you are using is lost.
    It would be helpful if you could support just SteamController.steamControllerType.
    This is used to display button icons.
     
    Last edited: Mar 30, 2022
  19. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Got a real product, ready to launch except this controller setup is a mess. using the new input system and heathen steamworks v2, mouse and keyboard work fine, but the controller is completely ignored.

    It's silly that Unreal got this buildt in so we generate all the files needed in the editor but on Unity i am forced to write this from scratch.

    The fight for indie developers is not in favor of unity these days.
     
    ModLunar likes this.
  20. djarcas

    djarcas

    Joined:
    Nov 15, 2012
    Posts:
    246
    Well... it's 2 years later, and I still don't see Steam Controller under the list of supported devices in the Input Manager - what gives?
     
    Necron99 likes this.