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