TIL UWP on Xbox One
Tags: todayilearned, gamedev, unity3d, uwp
Published: 2021-02-06 03:50:48

2021-02-05

One thing led to another and I just wanted to get a game of any kind running on an Xbox One. Initially I wanted to get a HTML/JS demo on there but I settled for Unity since it had a build option for UWP. Regardless, the first milestone to hit was getting a basic UWP deployed to and running on the Xbox.

I followed the well-written [documentation](https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/getting-started) and the process was mostly smooth. It went something like this.

1. Started installation of Visual Studio Community 2019 along with the Universal Windows Platform development workload.
2. While that was chugging along, I booted up my dormant Xbox One (2013) and switched it to Developer Mode. I ran into a snag here because I used Dev Mode Activation app which didn't think my Xbox was up-to-date when it was. I switched to the [Xbox Dev Mode](https://www.microsoft.com/en-us/p/xbox-dev-mode/9nljhzjrn0f4) app and successfully activated Dev mode.
![Cropped photo of Xbox Dev Mode running on Xbox One](https://dev-to-uploads.s3.amazonaws.com/i/joa93nyw59ge6bhv1equ.png)
  + In order to support deployment from my PC, I had to turn on Xbox Device Portal under Remote Access.
  + I verified I could access the Xbox through my browser.
3. Once VS2019 was ready, I made a sample project using the Blank App template.
![Screenshot of Create Project in Visual Studio showing Blank App template](https://dev-to-uploads.s3.amazonaws.com/i/aakyzcqed39m6oynhvsk.png)
4. In order to deploy this to the Xbox, a few things had to be done to the project settings.
  + Switched the platform to x64
  + Set the Target Device to Remote Machine. Fortunately finding the remote machine was trivial because it was auto-detected. No addresses to memorize! Color me impressed.
  + Changed Authentication Mode to Universal (Unencrypted Protocol)
5. Once I clicked to build the solution, the console mentioned that it was installing some missing frameworks (foreshadowing much?) and eventually pulled up pairing dialog.
![Collage of photo of pair code and screenshot of pairing dialog in Visual Studio](https://dev-to-uploads.s3.amazonaws.com/i/xfpdmjk2xupiiawbf2g6.png)
6. After that, a simple Edge-browser-like app showed up on the Xbox. There was a cursor controllable with the right analog stick. Nothing much to look at but a successful deployment nonetheless!

Of course, it was time to get a Unity demo in there next! At this point, the [documentation](https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/development-lanes-unity) gets a little weak. I ran into a few build errors but resolved them.

The first build error one may run into is that the default Build Type might be set to D3D Project. UWP Apps on Xbox are not allowed to use this so it needs to be set to XAML.

The second build error can occur if you're missing C++ Universal Windows Platform tools. I couldn't find this option during my Visual Studio Installer step so I thought I already had it installed. I didn't. 

In the end, I got a simple Unity demo running on the Xbox. Now it's time to flesh it out. What will the performance be like, I wonder.
![Photo of UWP app running on Xbox](https://dev-to-uploads.s3.amazonaws.com/i/jw8aqvk0jl1a1g14y3n6.png)