Open Arcalise08 opened 3 years ago
Using the test application I wrote before it behaves similarly to Valheim. I need to take out the batteries, plug them back in then hit the xbox button to get it to register that the the controller is there while the game is running.
Let me know how I can help here. I want to help make controllers work better in Steam.
Hello, im using the new input system and trying to talk with the DualSense controller through HID within Unity, unless Playstation Configuration is disabled or Steam Input in Game Settings is disabled, unity is unable to talk with the controller via the HID method.
@slouken It`s fixed now. Some seconds after the game starts the controller starts working normally. Thank you for the fix!
From what I understand of the conclusion, the proposed solution is to: 1) use the real app ID, and 2) publish Generic Gamepad as the default configuration for the App.
I've ensured both of those things, but the controller is still not recognized. As soon as I add the SteamManager script, it breaks the controller support in my game. If I rip the SteamManager back out, it works fine again. Or, if I keep the SteamManager, but exit the Steam client, I get an error on SteamAPI_Init() but the controller works.
Are you also launching your game from Steam?
Are you also launching your game from Steam?
No, I mean when debugging in Unity. Also, App ID 1456390 does not work either.
For now, I've added this prior to SteamAPI.Init() in my SteamManager.cs. This seems to work to prevent Steamworks from being loaded while in the Unity Editor, and so the controller continues to work in the Unity Editor.
if (Application.isEditor) { return; }
Also FWIW, the built application, with Steamworks.NET loaded and going through the RestartAppIfNecessary with my appID: the controller works (and Steam overlay works). As expected. Same built application, with steam_appid.txt with my appID: controller does not work. I see that if I delete the steam_appid.txt from my Unity project folder, it constantly gets recreated.
So you're saying that if your built application has steam_appid.txt, the controller doesn't work, but if you remove that file it does? Is it already published on Steam? If not, can you e-mail me at slouken@libsdl.org with a link to your build so I can try it out here?
So you're saying that if your built application has steam_appid.txt, the controller doesn't work, but if you remove that file it does? Is it already published on Steam? If not, can you e-mail me at slouken@libsdl.org with a link to your build so I can try it out here?
That's correct. You should have received access to the debug build by email. It's not published on Steam yet. It doesn't exactly surprise me, since RestartAppIfNecessary relaunches it with Steam injected as if you launched it from Steam. And if the steam_appid.txt file is found, it does not do this. As described here: https://steamworks.github.io/steammanager/
Ah, okay, that makes sense. Yes, in order for controllers to work properly the game needs to be launched from Steam, or with Steam injected as though you had launched it from Steam.
Hi @slouken, I'm on a VR project using the unity OpenXR (With the new Input system with actions) and I got the same issue that is mentionned in this thread.
All is fine if I don't initiliaze with the SteamAPI.Init(), but if we initialize, all our Unity's actions always return 0 values for the controllers. The HMD work as expected in both case.
I tried to set the Steam Input setting to "Generic Gamepad", but I think this not make sence in my context. Any recommandation to make it work with this kind of setup? (Considering we need to be cross platform with Meta Quest, so the OpenXR was appealing)
Thanks!
Does it work if your game is launched from Steam directly?
I don't have a version of the game with the Steamworks.NET integrated yet on Steam (But the current one without the Steamworks works). I tested locally with the steam_appid.txt. I guess I can try to upload a quick test build on a steam branch.
@slouken , I can confirm that works from Steam directly.
Guys, I will add my 5 cents to this. Using old unity 2019 with the legacy input system and NO steam running, no appid and no steamworks. Unplugging and replugging the controller messed up its mappings, unity sees 2 controllers now.
Decided that this is an Unity quirk that I will not just hack but vaporize.
Got the Xinput DotNet. Order of initialization: first Input for net then SteamWorks. Coded my own input manager and it works well and handles disconnects normally. Well. The game now loses its DirectInput support but in fine with it... SteamInput just works albeit I've got some recommendations when my free prologue was tested on Steam Deck that the game defaults to the deck controls... And I coded the game to only keep track of the gamepad who did its first input but I can control this too. So just prefer going with the actual APIS and not relying on the legacy input system. I don't like the new unity input system too, and unity still allows you to implement your input the way you want to.
Are there any updates on this? This issue is really blocking right now. I need to test controllers together with steam networking (it's the majority of my game). As far as I understand after reading this tread, the only work around requires you to build your application every time, there is no way to get controller + steam networking to work within the unity editor at once?
The exact issue has been identified as far as I understand, so is there any non-proper fix (that is not clean enough to implement officially in either steam/unity) I could perform locally? Building the application for every test I want to perform is not an acceptable solution as you could imagine.
Are there any updates on this? This issue is really blocking right now. I need to test controllers together with steam networking (it's the majority of my game). As far as I understand after reading this tread, the only work around requires you to build your application every time, there is no way to get controller + steam networking to work within the unity editor at once?
The exact issue has been identified as far as I understand, so is there any non-proper fix (that is not clean enough to implement officially in either steam/unity) I could perform locally? Building the application for every test I want to perform is not an acceptable solution as you could imagine.
@TarVK Yes, the issue has been identified long ago, and there is nothing Unity or this Steamworks.NET can do to fix it, as Steam is breaking the unwritten "rules" about hooking inputs and highjacking control and all around not being a good citizen in this situation. They would have to fix the Steam App to be more compatible with the OS and external Game Engines.
The primary "workaround" is to stop using Unity Input for controllers and just use it for Keyboard and Mouse. Then write your own Steam Controller input management around Steam Input using Steamworks.NET.
One alternative I head that works but I haven't tried myself is to use the Epic SDK instead of Steamworks and it has support for both Epic and Steam to allow you to write against it and release into both stores. Again I only heard this is an option that works but I have no tried it, not sure how they do this but they may be embedding SteamWorks own SDK in theirs as it is really the only way to deal with this. Meaning something or someone has to manage the crappy VDF files.
Another alternative is to not support steam or not to support controller input. Both of these options are not great and for many games are not viable.
For my application DSX on Steam which is made mainly for PS controllers, I can’t use my own communications method and use the steam api at the same time, since it hijacks, my own system used to communicate with the controllers completely stop working.
so I have to do dumb things that I didn’t need to do:
If steam just had an option for the devs, to completely disable the hijacking part aka steam input, then I would’ve been able to use the steam api while having my own controller communication system and not have to rely on a whole separate app just for api usage.
just doing Steam.Init() in my application which is just a WPF .NET app hijacks the normal Hid Library I have to directly read/send inputs to controllers.
All in all, I don’t think they will do anything about it, as it’s good for the games with lazy devs where steam takes care of things through hijacking. I understand their decision so that things just “work” outta the box, or without having to do a lot of work.
one last fix is to disable steam input in the game’s properties section, but that just means every user that downloads, has to also disable it manually vs just giving us devs some control on the input system.
Thanks for the response @CreepyGnome. I however realized I didn't read carefully enough, and after some more fiddling, I found a development setup that seems acceptable for me.
I ended up launching the unity editor from steam, and using this 1456390
app id (I haven't tested if that part is crucial).
Launching the unity editor from steam required me to create a batch file that runs a specific unity editor version (instead of launching the hub) and supplies the project to open:
"my\path\to\unity.exe" -projectPath "my\path\to\project"
I then used iexpress to create an exe around this bat file, in order to add it to my steam game library.
I've not had the time to extensively test this setup yet, so there may be additional caveats. But I at least was able to get some response out of my controllers again this way.
Ahh sorry @TarVK I misunderstood what you were having issues with. If you want to be able to run the game in Unity and talk to Steam for a game you have set up and registered with Steamworks so you can debug and test from Unity and use the controller without deploying via steam, you can do something even simpler.
Try launching steam from a custom shortcut that looks like this (assuming that is your appid):
"C:\Program Files (x86)\Steam\steam.exe" -forcecontrollerappid 1456390
I run steam with that anytime I need to make sure the controller works with the game I am developing while steam is up and the other steam services will be happy as well. This requires you to have your VDF files set up and discoverably per Steam Input requirements, etc etc.
Beware appid 1456390
does not exist anymore!! Do not use it!
https://store.steampowered.com/app/1456390 navigates to home page
@slouken sorry for mentioning here, but I guess your answer will be better than Steam Support... I implemented SIAPI in 670510 / beta-4-unstable branch (as a VAlve Employee you know exactly what this mean) and I implemented Action Sets. My game uses Unity, but I am NOT using any of its default input systems (except the old legacy one for keyboard). For XInput I use https://github.com/speps/XInputDotNet, and SIAPI for everything else.
XInputDotNet only detects REAL hardware devices, and not emulated ones. SIAPI works perfectly when I use the configurations for Xbox, DualSense and Nintendo Switch controllers when the game is launched from steam or when I do forceunputappid/670510 cia cmd/run.
There is however an issue with the Steam Link Mobile app - There is not a wsay i can bind the virtual XBOX controller to work at all with the Unity Editor (and in a build, too). The application is not released yet... can you assist me? You can email me? my username is petersvp everywhere. including Discord and Steam
Not sure if this intended or not. But upon initializing steamworks. My xbox one controller is no longer recognized within unity. No inputs will reach it until i close steam. I can get the game working by building it, opening the overlay and going to controller configurations then selecting to apply the generic gamepad. It will then work as intended. But within the editor nothing i do seems to work.