Publishing

This is an excerpt chapter from my Weekend Code Project: Unity’s New 2D Workflow book. I hope you enjoy this free content on how to use Unity’s new 2D features. If you like what you see, please pick up a copy of the book to get access to the artwork, source code and a PDF/ePub version of the book.

Build Settings

One of the biggest advantages of Unity is its ability to publish to multiple platforms. In this section we are going to do a quick overview of how to publish from Unity on different platforms. There are lots of resources out there that cover this process in more detail but this high level overview will give you the basic working knowledge of where to gets started. To access the output options, open the Build Settings from the file menu.

From there you will be presented with all the options that I will go over next.

Web

Out of all the options, Web Player is the easiest of the Unity output options. Simply select Web Player from the Platform menu:

You will also want to make sure you include the current game scene so that it becomes the default scene in your outputted project. At this point you should have all three scenes in this menu:

From here you can click on the Build button, which will give you an option to save out the project. I usually create a Build folder in my project and organize them by target platform; in this case I save out to a Web folder:

Once Unity creates the build you will see a standard Web.html file and the project file itself:

From here if you open the Web.html file in your browser, you should be able to play the game, assuming you have the plugin installed. From there you can simply upload this to a server or game portal that supports Unity and let others play your game online.

The last thing I wanted to point out was that if you click on the Player Settings button, which works for any platform you output to, the inspector panel will open up and provide additional export options for you:

You may want to dig deeper into the Resolution and Presentation tab where you can configure the game’s embed resolution, if it runs in the background and what the page template is set to.

Desktop

Desktop is the next platform that is incredibly easy to build for. Switch over to the desktop option in the Platform menu. 

As you can see, you now have the ability to choose your platform from the drop down which includes Windows, Mac and Linux:

Similar to how the Web output worked, once you hit Build you will be asked to save out the game and again I create a new folder called Desktop in my Build directory. From there Unity will generate out an executable based on your targeted platform.

As you can imagine there are even more option for configuring desktop builds. Again the resolution tab is going to be the most important one to pay attention to:

When it comes to desktop and mobile, supporting different aspect ratios is going to be critical to the way your games looks in the finished product. At the end of the publishing section I will briefly talk about aspect ratio and how you test out each aspect ratio when playing your game back in the Unity IDE.

Android

Out of all the mobile platform build options, Android is going to be the easiest one to build for.

You will need to do a few additional things from what we saw when doing builds for Web or Desktop. Like with the other two builds, you will be asked for a location to save your game’s APK. I created an Android folder in my Build directory just like in the previous two examples. Once you save the path to the APK you will be asked for the path to the Android SDK. You can download this from the Android Developer Site at https://developer.android.com/sdk. Note that you will also need to have the JDK installed on Windows as well if you have not configured your computer for Android development already. On the Mac this is a little easier to setup. Once you have that all installed and ready to do an Android build, simply point Unity to the root of the Android SDK you downloaded to your computer.

Unity also requires you to make modifications to the Android build settings, most important being updating the Bundle Identifier.

Since we are also building for mobile it may be best to set the Default Orientation to Landscape and make sure to check Status Bar Hidden.

If you start a build and forget to change the Bundle Identifier you will get a build error like this.

Outside of that you should have everything setup now to build to Android. You can chose to manually install the generated APK yourself or connect an Android device via USB and have Unity install and run it for you which is incredibly convenient.

iOS

iOS perhaps one of the more difficult platforms to get up and running on. If you have done any work on iOS before you will be familiar with setting up provisioning and testing apps on devices. At a high level, when you do an iOS build you will be asked for a place to save your final game. Here you can see I set up an iOS folder just like we did for all of our other platforms.

It is critical that you create a separate folder for your iOS build because Unity doesn’t just create a single file for your game; it actually generates a full Xcode project. Once the build is done you can open up the directory to see the project:

From here you can open up the Unity-iPhone.xcodeproj file and begin working on setting it up to run in Xcode:

Unity has an excellent getting started guide on working with iOS, which you can check out on their site at http://docs.unity3d.com/Documentation/Manual/iphone-GettingStarted.html. There area steps involved in order to get an iOS device configured to test with including setting up your developer provisioning and readying a device for development. Just keep in mind that you will need to have a physical iOS device to test your game out with since you can’t rely on the emulator.

Windows Store

While there may be a little confusion over the difference between the Windows Store Apps and Windows Desktop, this option is to target Windows 8. This means that while you can still create desktop builds of your games that run on Window 8 via the PC build option, if you want to distribute them in the Window Store you will have to select it specifically as a build target.

There are two targets for Windows 8, 8.0 and 8.1. It is also important to mention that in order to build to Windows Store you need to be on Windows 8 or 8.1. When you run a Windows Store build it will generate a Visual Studio Project similar to what we saw on iOS. I save my build out to its own Windows Store folder in my Build directory.

Simply click on the solution file to open it up in Visual Studio.

From here you can click on the compile button at the top of the screen with the green arrow that says Local Machine. This will build the game and install it as a Modern App for testing.

Just like the other platforms, you will want to walk through the configuration options and make sure you support the additional artwork such as icons, splash screen and more for the Windows Store.

Windows Phone

Windows Phone is similar to building for Window Store. Unity will output a Visual Studio project for Windows Phone and you’ll follow a similar process to how we created the Windows 8 Visual Studio Project. Simply follow the steps you have gone through above in the Windows 8 build to create a Windows Phone build in Visual Studio. You will need a physical Windows Phone for testing.

Subscribe To My Mailing List

Want to learn how to make a game? Not sure where to start? Even if you are a seasoned game maker there is still a lot you can learn from my mailing list. I'll be covering tips and tricks for how to build, release and market games each month.

Simply sign up for my mailing list and also get access to a 50% off discount code for my eBooks and other content. I promise to not spam your inbox!

Join Now