How to build and emulate for Universal Windows Platform with Unity 5.3

This procedure has been tested using Windows 8.1 and Windows 10 with Unity 5.3.1p2 and Visual Studio Community 2015 Version 14.0.24720.00 Update 1.

Note: Although the Unity docs state that “Currently if you want to build for Universal Windows 10 Applications (a.k.a UWP), you have to do it on Windows 10.” (http://docs.unity3d.com/Manual/universal-windows-10-apps.html), building on Windows 8.1 also seems to work for me. Perhaps the docs are not up to date with the current Unity version (5.3.1p2).

0. If you are going to use the Windows Phone emulator, make sure you are using a Pro or Enterprise version of Windows 8 or 10. Also make sure that your computer supports Hyper-V. More info and possible work arounds:

https://msdn.microsoft.com/library/windows/apps/mt162269.aspx
http://superuser.com/questions/524828/how-can-i-tell-which-version-of-windows-8-i-am-running-standard-pro-enterpris
http://stackoverflow.com/questions/22296797/windows-phone-emulator-doesnt-run-without-hyper-v-on-win-8-1-any-alternative
http://www.cnet.com/news/microsoft-launches-free-90-day-trial-version-of-windows-10/

1. Install the Windows Store IL2CPP Scripting Backend in Unity (you have to mark that you want it during the Unity installation in the Unity Download Assistant). IL2CPP is currently (2016-01-15) experimental for Windows Phone and only supports the Windows 10 SDK. The alternative is to use the Windows Store .Net Scripting Backend. However, that backend is based on .Net Core which does not support all the standard classes available in .Net/Unity, see the links below for more info:

http://docs.unity3d.com/Manual/windowsstore-dotnet.html
https://msdn.microsoft.com/en-us/library/windows/apps/br230232.aspx

1.1. If you really want/need to use the Windows Store .Net Scripting Backend, you can use preprocessor directives to exchange code based on which platform you are compiling for. You can find the available preprocessor directives here: http://docs.unity3d.com/Manual/PlatformDependentCompilation.html

Especially NETFX_CORE and WINDOWS_UWP may be useful.

2. Choose to use IL2CPP to compile your Unity project: In Unity, go to Player Settings (Edit->Project Settings->Player). Click on the Windows Store icon in the Player Settings. Go to Other Settings->Configuration->ScriptingBackend and choose IL2CPP. This is the same procedure as is used when choosing scripting backend for iOS in Unity: http://docs.unity3d.com/Manual/iphone-64bit.html

3. In Unity Build Settings (File->Build Settings…), choose SDK->Universal 10. Then press Build. If Unity complains about a missing Windows SDK, download the one found here: https://dev.windows.com/en-us/downloads/windows-10-sdk

4. Make sure you have Visual Studio 2015 Update 1 installed. Versions before that have a known optimization bug with Unity (http://forum.unity3d.com/threads/warning-about-vs2015-optimizer-bug-please-update-to-vs2015-update-1.378181/). If you already have Visual Studio 2015 installed, a small flag in the top right corner should appear if there is an update available. Click on it to see which updates exist. Also make sure that Windows 10 SDK (includes emulator) and Windows 8.1 SDK and emulator are installed in Visual Studio if you intend to use those. (Visual Studio will probably also warn you if you try to use them without installing them.)

5. See the following video for the rest of the build and emulator procedure (starts about 30 minutes in): https://mix.office.com/watch/qqsyfebysgrj

6. For more information about the resulting project structure, Debug/Release/Master configuration in Visual Studio etc. see:

http://docs.unity3d.com/Manual/windowsstore-generatedproject-il2cpp.html
http://docs.unity3d.com/Manual/windowsstore-faq.html

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: