ARKit Setup with Unity to Build Mobile AR
I think you’ll agree that setting up ARKit can be tricky when you are first getting started with it, we had some trouble ourselves, so we decided to create a short setup guide for ARKit. Of course, if you want a more in-depth understanding of ARKit and programming with Unity, check out our courses available for beginners to experts for more details!
In this post, we’ll talk a little bit about ARKit first, then Usman will share a 13 step video setup guide for Unity development.
And, for you techies, we have all the technical steps at the bottom of the post.
Let’s get started and set up Apple’s ARKit in Unity!
What Is ARKit?
So we need to address a couple of things before we dive into this guide. First: what is ARKit? And second: why do you need to use Unity, too? Well, it’s actually pretty simple.
ARKit is Apple’s tool for developing augmented reality applications. Even if you don’t know what augmented reality (or AR) is, if you’ve ever used Snapchat you know what it does. AR is what happens when you hold your mobile camera up to something and your phone generates a programmed response–or augmentation–of some kind. Like sunglasses. Or zombies. Or a million Rattatas when you really don’t need another Rattata.
ARKit allows you to actually create AR experiences for supported Apple devices. So far, compatibility is limited to the newest iPhone and iPad models: iPhone 6s, 6s Plus, iPhone 7, 7 Plus, iPhone 8, 8 Plus, iPhone X, iPad (2017) and iPad Pro. But that’s still a ton of devices. Because of Apple’s massive market, ARKit is the biggest AR platform in the world. Developers are flocking to ARKit to take advantage of the huge Apple user base, including hundreds of millions of people who regularly use iOS 11. This is your opportunity to get into the AR market and build your awesome idea. But in order to actually use ARKit to build, you’ll need to pair it with development software like SceneKit or Unity.
It’s no secret that we’re Unity fans. In our humble—but vastly informed—opinion, it’s the best all-around development option. It’s powerful, supported by a huge developer community, and free. So if you’re going to use ARKit to take advantage of Apple’s proprietary AR capabilities, we recommend using it with Unity. Let’s get you set up.
|Download our 10-week AR Development with Unity Course Syllabus|
Before we dive into Unity…
There are a few steps we have to go through before we’re able to open Unity and actually start building our project. One of the most important prerequisites is to make sure you have access to a Mac computer as well as an Apple device.
Step 1: If you don’t already have one, you’ll need to create an Apple ID. You can do that here.
Step 2: Now you’ll need to get Apple’s developer tool Xcode, which enables ARKit to do its job. You need version 9 or higher. Download it from the Mac App Store if you don’t already have it on your computer.
Step 3: Launch the Unity installer, making sure that “iOS Build Support” is selected in the installation options, for obvious reasons.
Step 4: Open your Apple device (phone or iPad) and enable developer mode. Having trouble with that? At this point, you also need to make sure your device is running the latest update of iOS 11 or higher.
Let’s get this project started!
Step 5: Open Unity. We’re finally here. Create a new project and go to the asset store, where you’ll be able to find the Unity ARKit Plugin. Select that, then download and import it into your project.
Step 6: Head up to the Edit menu and select Project Settings > Editor > Device(inspector). When the window opens, keep your options open by selecting “Any iOS Device.”
Unity Build Settings
Now we’re going to adjust a few things in our Build Settings. You can find the Build Settings options in the File menu at the top.
Step 8: The first change we want to make is switching the platform to iOS. So that, step-by-step, is File > Build Settings > select iOS. Check “Development Build” in that window as well, and check “ARKitScene” in the scenes section of the build options.
Step 9: Back to File > Build Settings, because we’re going to adjust some settings in our player inspector. So click on “Player Settings,” then “Other Settings (Inspector).” Here, you’ll need to enter a unique “Bundle Identifier.” Make sure you match it with your Company and Product name. Double check that the camera usage description is not blank, then set the target minimum iOS version to 11.0.
Step 10: Go back into Build Settings and click “Build and Run.” Don’t panic! Xcode will launch with a build failure. That’s exactly what we want.
Step 11: In the top left, click Buildtime, then select the folder Unity-iPhone and look for the “signing” section in the middle pane. Click on “Team” to access the dropdown menu, and select your Apple developer account. If you don’t have that option, add one.
Step 12: Underneath that section, in Deployment, select your Apple device (iPhone or iPad). Head to the Product menu and click “Build.” After the build is complete, head back to the Product menu and click “Run.”
On Your iPhone or iPad
Step 13: Your app probably won’t deploy right away. That’s fine! Go into your device’s settings menu, then to General > Profiles > Device Management > Develop. Once there, select the option to “trust your computer/app.” Voila!
- Create an Apple ID, go to developer.apple.com and enroll your account as a developer.
- Download the latest version of Xcode (version 9.0 or higher).
- Check that iOS build support is included when you install Unity3D. Otherwise launch the installer again and only check “iOS Build Support”, then Install.
- Enable Developer mode on your apple device and assure it is updated to iOS software 11 or higher.
- Open the Settings app on your mobile device.
- Launch Xcode on your computer and plug in your device. You should then see a hammer icon labeled Developer in your settings app. Tap the hammer icon and you will have enabled developer mode on your device.
- Create a new project and go to the asset store in Unity. Download and import the “Unity ARKit Plugin”.
- Go to Edit > Project Settings > Editor > Device(inspector) and select “Any iOS Device”
- Go to file > Build Settings >
- Select iOS to switch platform.
- Check Development Build
- Check “ARKitScene” in the scenes in the build section
- Go to File > Build Settings > Player Settings > Other Settings(Inspector) >
- Enter a unique “Bundle Identifier”, match this with Company and Product name
- Assure Camera usage Description is not blank
- Set “Target minimum iOS version” to 11.0
- Go to File > Build Settings > click “Build and Run”
- Xcode should launch with a build failure
- Click top left “buildtime” section the folder “Unity -iPhone…” and see the “signing” section in the middle pane, click the “Team” drop down to select your apple developer account. If not present add an account. Underneath in the deployment section select your apple device iPhone/iPad.
- Go to Product > Build. After it finishes building, go to Product > Run
- Unless your app deploys right away go to your device’s settings > General > Profiles and Device Management > Develop, and then select “Trust ‘your computer/app’”
Do you want to build AR for Android?
Are you looking for a guide to developing for Android with ARCore or instructions on how to use Vuforia with Unity? Here are some other setup guides: