Skip to main content
April 18, 2016
Mobile

Intro to porting Unity games to UWP: Building and deploying



Hero_FINAL-Unity

Did you know that you can easily get your Unity 3D game into the Windows Store simply by creating it in Unity or porting an existing game to the Universal Windows Platform (UWP)? That’s a big deal, because the Windows Store opens up the whole spectrum of Windows 10 devices, and their users, to your game: PCs, tablets, Windows 10 phones, Xbox One, and even HoloLens.

In this post, we’re going to go over how to deploy a game from Unity 3D to a UWP project and then build your new UWP game in Visual Studio.

What you need

To develop, compile, and submit a Unity game to the Windows Store, you will need:

  • Unity – Either the Unity free version or Unity Pro will work. The add-ons for publishing to the Windows Store are free for both basic and Unity Pro users.
  • Visual Studio – You can use any Visual Studio SKU, including the free Visual Studio Community. To target Universal Windows Platform, you will need at least Visual Studio 2015 Update 1.
  • Windows 10 – If you do not own a Windows 10 license, you can get a 90-day evaluation version. If you are running Mac OS X or will install on Apple hardware, check different options for installing using Boot Camp, VMWare, or Parallels.
  • Windows Store developer account – This will be needed to submit your game to the Windows Store. During this process you will register and get verified as an individual or as a business who can submit apps and games to the store. This registration allows you to submit apps and games to PC, Phone, Tablet and also in the future to HoloLens and Xbox. There is a small registration fee for individuals to sign up, although free Dev Center accounts are often available through Microsoft-sponsored programs (e.g. for startups).
  • Windows 10 test devices – While the Visual Studio simulators and emulators can replicate multi-touch and different display resolutions, it is recommended that you test on a real ARM mobile device with touch capability if you are developing a mobile/touch experience.

In this post, we will use Unity 5.3.3, Visual Studio 2015 Update 1, and Windows 10 Version 1511. For your benefit, it is recommended that you use at least Unity 5.3.2. Newer versions may have a different application programming interface.

Configuring developer mode in Windows 10

For Windows 10, whether using a desktop, tablet, or phone, you need to enable that device for development under System Settings.

To do so, navigate to System Settings and choose “Update & security.” Then choose, “For developers.” From here, you can simply select and enable “Developer mode.”

1_developerfeatures

Deploying your game from Unity

For the purposes of this post, let’s assume that you have already created a game in Unity. If you haven’t, though, there are several great Unity 3D tutorials available to get you started.

If your game was originally built for iOS or Android, it is important that you don’t have any platform specific controls or DLLs before attempting this. If you have platform specific code or libraries, the process outlined in this post may throw errors before you get to the end.

To start, we’re going to open up your Unity project and configure the build settings. To configure your settings in Unity, first click “File,” then “Build Settings.”

 

2_buildsettings

Next, choose Windows Store in the Platform Window. Then select Universal 10 in the SDK dropdown.

3_universal10

Select XAML in the UWP Build Type dropdown.

4_XAML

Next, click the Player Settings… button.

5_playersettings

Enter your game details in the “Player Settings” window such as your default icon and product name. Your build settings are now properly configured in Unity3D to allow you to export to UWP.

6_gamesettings

Click on the Build button in the Build Settings window. You will be prompted with a Build Windows Store dialog to select a folder for building your game.

7_selectfolder

Once you have selected the folder, Unity will begin building your game, targeting the platform you selected. This can take several minutes if you have a lot of assets.

8_build

A Windows Explorer window should now display the folder containing all the files generated by Unity.

9_buildfolder

You will need to remember the location of your Visual Studio solution for the next step.

Building your UWP game in Visual Studio

From here on out, you’ll be working in Visual Studio. We’ve already exported your Unity 3D game into a UWP solution.

To get started in Visual Studio, navigate to the folder where you deployed the solution and open it in Visual Studio.

In order to distribute your UWP app to other users, either on the store or for sideloading, you need to follow the steps to create an appxupload package for it. When you create the appxupload, an additional appx package will be generated to use for testing and sideloading.

First, select either x86 or x64 from the platform dropdown as the platform.

10_appxupload

From the menu, click Build -> Build Solution or press F6.

11_buildsolution

Allow the NuGet Package Manager to restore packages.

12_packagerestore

Set the target to Local Machine. Then click Run. You can watch the progress of the build in the Output window.

13_localmachine

Finally, verify that the build succeeded.

14_buildsucceeded

Now you are ready to deploy your app in Windows Store.

Note: If you intend to share the app with friends outside of Windows Store first, you can also sideload this app to install it on any Windows 10 device.

You will need to associate your app to with the Windows Store. To do so, navigate to the Project menu and choose Store -> Associate App with the Store….

15_associateapp

Your app is now enabled for test purchase and notification scenarios if you choose to do so.

When you associate your app with the store, the following values are downloaded to the app manifest file for the current project on your local machine:

  • Package Display Name
  • Package Name
  • Publisher ID
  • Publisher Display Name
  • Version

Note that you can override the default package.appxmanifest file by creating a custom .xml file for the manifest. As a general rule, however, you do not want to do this and really don’t want to alter the manifest file at all if you aren’t completely sure of what you are doing.

Wrapping Up

In this post, we’ve covered how to take your Unity 3D game and prepare it for deployment to the Windows Store. By using Unity 3D and Visual Studio together in your development toolchain, you can gain a much wider audience for your games. Just as exciting, you can potentially deploy your games to a greater variety of devices from tablets to phablets to gaming consoles to the latest emerging technologies built around Windows 10.