I just wanted to cover some stuff that you need to handle when porting your Unity game to Windows Phone. What’s required to get started and what’s required to pass store certification.
First, let’s cover what’s required to get started.
- Unity 4.3.3 or higher
- Windows 8.1 x64(to run the emulator)
- Visual Studio 2013/2012
- Windows Phone SDK
- Developer account
Now, you should already know how to get the latest version of Unity. If not, then you probably shouldn’t be reading this blog post, but rather this getting started page on Unity’s own site.
How do I get the other stuff?
Windows 8.1 is installed on most new PCs, so that is one route to go. You can also purchase a copy and install it from here or any other retailer.
If you are a student enrolled at school who has DreamSpark Premium or a startup who has a BizSpark account, you can download Windows 8.1 for free.
You can always start with the free version of Visual Studio 2012 for Windows Phone found here. You can also take advantage of DreamSpark/BizSpark and download Visual Studio 2013 Ultimate from your associated account (which is what I would do. I mean, why not?)
Windows Phone SDK
If you’re lucky enough to grab a copy of VS 2013 Ultimate, or you decided to use VS 2012 for WP, then the Windows Phone 8 SDK come with both of those by default. If you have another version of visual studio, you can download the SDK as a separate install from here.
Important note about running the emulators – your PC hardware must support hardware-assisted virtualization, SLAT, hardware DEP and have a minimum of 4GB of RAM on top of running Windows 8.1 x64 in order to run the emulator. This should not be an issue with most modern hardware. However, you may need to enable these things in your BIOS.
Again, this is a good place to use your DreamSpark or BizSpark benefits if you have them, since you get a free developer account with each. If it’s just you then you will need to shell out $19 for yourself to register or $99 for your company to register. You can started with that process here. NOTE: to access your free developer account benefit, you will need to grab the code from your DreamSpark/BizSpark account page and enter it in at checkout when registering on the developer account page.
Exporting your game
Once you have all of the tools and that incredibly awesome game that you built, you will want to export the game from Unity into a Visual Studio solution, so that you can build and debug the project. Let’s take a look at that process.
- Open File->Build Settings in Unity and select Windows Phone 8. NOTE: If you plan on profiling your game from Unity, then check Development Build to enable that.
- Press Build and select an output folder for your game’s Visual Studio Solution. I usually create a folder under my main project folder to hold this output.
Once you get your Visual Studio solution output, you can open it and do a few things to run your game.
If you have a Windows Phone device that you would like to run your game on, make sure it is developer unlocked. If you’ve never done this before, you can follow the instructions found here.
Once your phone is connected to the PC via USB cable, you can build, deploy and debug right from Visual Studio to your device by pressing the Run button.
If you don’t have a Windows Phone device to run on, you can run your game using an emulator. In Visual Studio, simply select this drop-down and select the applicable emulator. As noted above, your machine needs to be capable of running the emulator!
The fun stuff!
…otherwise known as – certification. What do you absolutely have to add to or handle in your game in order to pass store certification? Let’s take a look.
The Back button – Windows Phone requires handset manufacturers to implement a hardware back button for a consistent user experience. Because of this, your game should behave similar to the guidance below in order to pass certification.
- During gameplay – present a pause menu/dialog or navigate to the previous menu. For example, in a simple game, you may simply want to return to the main menu of your game when the back button is pressed.
- In the pause menu/dialog – pressing the back button should exit the menu/dialog and resume the game.
- In the main menu – if the back button is pressed during the main menu, then your game should exit.
Here’s a code sample of handling the back button in Unity
Next post, I will go into adding tailoring the splash screen experience, handling orientation, and pausing and resuming. As always, I welcome any questions in the comments section.