Hi? I’m looking for a way to obtain a connected device info, such an id or serial, on my app. is there a way ?
I know I can get the info on the app device, but if I connect headphones or an aditional keyboard I want to get its factory info or something similar.
Thanks in advance.
Since Unity is not providing such information in any of their own APIs and because Unity uses Mono which does not implement any of the System.Management types (which is the namespace used for gathering data such as connected devices info), you’re basically left in the dark.
If you really need it what you can do is develop an assembly that you compile towards .NET Framework using MSBuild instead of Unity/Mono, and then from within Unity do some interop’ing to call the functions of that DLL using DllImport.
It’s a big rabbit hole to dwell into.
What platform is this for?
- thanks for the answer jilleJr;
Mainly android and iOS. (Joe-Censored)
To update the topic, here are some good documentation by Unity:
https://docs.unity3d.com/Manual/NativePlugins.html
You will need to create some sort of method/type signature and create native plugins for each build target to feed device information into your Unity project.
If, say, you wanted to presume this way.
Cheers