An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi @you74674 ,
Thanks for reaching out.
After you register your factory using GameControllerFactoryManager.RegisterCustomFactoryForHardwareId, the system can call CreateGameController when it detects a matching device, so it makes sense that you’re seeing that part triggered.
The part that’s less clear in the docs is around OnGameControllerAdded and OnGameControllerRemoved. Based on the current documentation and observed behavior, these methods do not appear to be invoked automatically by the platform in this scenario.
Because of that, you may need to maintain your own controller collection and handle add/remove logic on your side based on device enumeration.
To do that, you could look into using DeviceWatcher, which lets you listen for devices being added or removed: https://dori-uw-1.kuma-moon.com/en-us/uwp/api/windows.devices.enumeration.devicewatcher
This can help you notice when a device is no longer available, so you can update your controller list accordingly.
On the device identity side, the provider you get in CreateGameController doesn’t seem to expose a unique ID. If you need to distinguish multiple devices with the same VendorId/ProductId, you may need to pull the Device Id from DeviceInformation and map it yourself:
https://dori-uw-1.kuma-moon.com/en-us/uwp/api/windows.devices.enumeration.deviceinformation
Also, just to clarify on language support, this API under Windows.Gaming.Input does have a C# projection (you can see C# listed in the API page above), so it can be used from C#. The main challenge here is more around lifecycle handling and limited documentation, rather than the language itself.
Hope this clarifies! If my answer was helpful, I would greatly appreciate it if you could follow the instructions here so others with the same problem can benefit as well.