If you're used to working on Windows but want to deploy your Unity game for iOS, read up on our step by step guide.
Historically, we have avoided publishing our games on the Apple App Store since there is a recurring cost of $99 per year associated with having the required developer account. The Google Play Store only wanted a one-time $25 fee, and we were all Android users back in the day. Over the last couple years, though, I have switched to having an iPhone. We also started to take notice that Apple had a pretty good market share for most of our friends and family that we wanted to share our games with. So Matt and I made the decision to bite the bullet and pay to get our content out there. In addition to historically not having Apple phones, we have always developed our Unity games while working on Windows machines. The process of going from developing in a Windows environment to building and deploying your game on a Mac had a little bit of a learning curve, so I figured I would document it for myself and others who might need something to reference in the future.
So follow along with a ten step checklist to get that beautiful game you've written out on iPhones and iPads in the hands of even more players. You can get by without an iPhone for this by relying on simulators, but you will at least need a computer running Mac OS.
1 - Install Xcode from App Store
Go ahead and kick this one off first because it takes some time. Head over to the App Store and search for Xcode. Xcode is a development environment provided by Apple. Unity will output an Xcode project when you build for iOS, and then your actual final game will be built from Xcode.
Unity tries to auto-detect an Xcode install, so that's just another good reason to take care of this one first. It's been successful every time I've done this, but it's possible to manually configure the Xcode install location from Unity if you need to.
2 - Copy Over Your Project
You need to get all the source code for your game copied from whatever computer you have been working on over to the Mac where you are trying to build your game. It's probably best to do this with some form of version control if you're familiar with that. If not, just copying your files over with cloud storage or a flash drive will work just fine.
3 - Install Unity Hub
Unity Hub is the application distributed by Unity to manage your projects and installations. This is pretty useful for managing different versions of Unity or multiple projects in an easy enough way.
Here’s where you can get the installer: https://unity.com/download.
4 - Activate License
You’ll need a Unity account for this, but you probably already have one from writing your game. Not really much to say on this one.
5 - Install the Version of Unity You Need
Whatever version you used writing the game, just stick with that. This is not the time to trying upgrading the editor or building it with a different version than you have used developing it. Save yourself the trouble of ruling out anything that might introduce variance or issues for the time being. Be sure to check the option to enable builds for iOS whenever you are prompted.
6 - Verify You Can Run and Play Your Game Like Normal
Open up your scene, hit play, and just double check the game runs okay. This is a good time to just be sure that you copied the game over correctly and don't have any other problems at play. If everything is looking good, then it's time to move on making a build of your Unity game to publish on the App Store.
7 - Build Settings
Within Unity, open up the "Build Settings" window. Select iOS from the menu on the left, and then press "Switch Platform". Once you have made that selection, double check that the "Run in Xcode" configuration has a version selected. This means Unity has correctly auto-detected the Xcode install that you did earlier in the process. Finally, select “Build and Run” and choose an empty folder you like.
This may not happen to you, but I ran into build failures at this point because Matt was using a Google Play library not intended for iOS. Since this code couldn't be used on the built target I had selected, I wrapped these parts of our script with:
#if UNITY_ANDROID Debug.Log("Code that should only run on Android."); #endif
How to use these could make for a whole blog post of its own, but essentially these empower you to conditionally only include certain parts of your code depending on which platform you are targeting. Unity details how these work from their docs if you want some extra info.
8 - Prepare for Submission
Setup an App in App Store Connect
Whenever you are preparing a listing for your game, Apple will require you to submit a number of screenshots for different sized devices. Unless you have all these devices handy and like to do things the hard way, I think the best thing to do is to use simulators for this. To build for the iOS simulators, be sure to go to the Player Settings within Build Settings and change the “Target SDK” to “Simulator SDK”. The iOS simulators aren't quite emulators and require special builds targeting them.
As of the writing of this post (Jan 2022), you need four different resolutions. Here are the four simulators to get what you need:
Double Check Some Things
This is the time to double check you have an icon, a bundle identifier (a unique ID for your app), and a good version number for your app. All of this stuff can be configured in the Build Settings area of Unity before you make a build. You might already have this set up globally if you have been publishing the game on other platforms. You can also directly edit these in the Xcode project, but keep in mind they can be overwritten if you do a new build from Unity. From Xcode, also sign in to your Apple Account and configure signing. There is an easy button where it will automatically handle your certificates and all that for you. I'd suggest you use this option unless you know what you're doing and have a good reason not to.
9 - Make and Upload an Archive
Archives are the complete package needed to distribute your game. Go to Product → Archive to make the archive. Once it’s made, you can select it from the Archives window and press “Distribute App”. Afterward, you should see your build on the TestFlight tab within App Store Connect; it’ll sit there processing for a little bit as Apple does some sort of validation.
10 - Submit for Review
Once you’ve got everything ready, go ahead and hit that button to submit your game for review. 🤞 Apple usually finishes within 24-48 hours. If you’re approved, congrats and welcome to the App Store! If not, they’ll let you know what you need to tweak with your game to get it ready for the store.