UWP device detection

I know, that with #if UNITY_WSA_10_0 I can execute specific code if this is UWP build, however my question is - how can I check what device it is, mainly XBOX, build running on PC or on Mobile ?

While it is nice that same build can work everywhere PC build require Exit button and mobile build require touch controls and not Xbox controller and it would be nice if my game can actually detect on what it is and work accordingly.

Thanks.

(tl;dr Skip to the bottom to for detecting tablet vs desktop.)

Well here’s the reason it’s hard. Microsoft is trying to remove the concept that mobile, desktop, and console are different things.

Microsoft does not feel UWP apps need an exit button. Users should not need to worry about the lifecycle of the app. The OS provides ways to close an app already.

Microsoft wants touch controls on both mobile, and desktop for those with touch screens. I wouldn’t be surprised if touchscreens are common with Xboxs in the future .

Xbox controllers can be attached to xboxs, desktops, and mobile platforms. Controllers should not be disabled only for mobile.

This is Microsoft’s style and what they would like in the future. I’m not saying MS is always right! f you still want to know if it is a touch interface or a mouse interface you can check:

I’m not sure how to check Xbox. Microsoft prefers we check for features instead of platforms. You can check what APIs are available for the current system.
https://blogs.windows.com/buildingapps/2015/09/15/dynamically-detecting-features-with-api-contracts-10-by-10/

I would agree with this.

In my game I am detecting if the user has a controller connected. If so I am showing / hiding certain UI elements.

I have also gone through my game and ensured that the navigation properties on buttons are set correctly.

I have opted for explicated navigation so I can control which objects get focus when the user navigates using a controller.

Thanks, I got basic idea:

  • if controller detected use game pad
  • if controller is not detected assume it is touch screen
    ** if it is touch screen and keyboard key is pressed switch to PC
    ** if in PC and tap/mouse click is detected switch to touch screen

Thanks for help.