Getting Started With ARDK
This document describes the basic steps for getting started with ARDK. You’ll set up your developer environment and create a Unity project that integrates with the ARDK.
For a step-by-step getting started guide and video, see the Getting Started Basics Guide
Set Up Your Developer Environment
Make sure your development environment meets the development requirements as described in System Requirements. At a minimum you’ll need to install Unity and the development tools for either iOS or Android.
Download the ARDK
Download the ARDK using the following instructions:
ARDK Downloads - Downloads page for ARDK.
Generate an API Key
You’ll need an ARDK API key to use some ARDK features such as networking and depth estimation. To generate a new API key, navigate to your Lightship Account Dashboard and under Projects, click New Project to create a new project and Create New Key to create a new API key for that project.
Create or Open a Unity Project
Create a new 3D Unity project. In the project you can use the default sample scene or create a new one.
Add the ARDK Package
Import the ARDK into your project as a custom Unity package. See instructions here: Adding ARDK to your Unity project
If your project is already using an older version of ARDK, see instructions for upgrading your project to use the new ARDK version here: Upgrading ARDK
Add an Authentication Asset
ARDK features, such as networking and depth estimation, are authenticated against your API key. The ARDK provides an ArdkAuthConfig asset that you use to set the API key used to make API calls. Add an ArdkAuthConfig by following the first 3 steps in Authentication.
Configure an AR-aware Camera
In most cases you’ll want to configure a scene camera that is connected to the ARDK. ARDK features need to synchronize real-world camera information from the mobile device with the Unity camera. To make this connection you can use the ARSceneCamera prefab that the ARDK provides, or add ARCameraPositionHelper and ARRenderingManager components to your existing scene camera. To add a ARSceneCamera prefab to your scene:
Delete any default scene cameras that you don’t need.
In the Project View, navigate to ARDK/Extensions/Prefabs.
Drag ARSceneCamera into your scene and set the position as desired.
For any other ARDK managers you add to the scene, make sure the “Camera” field of those managers (if any) is set to this camera.
Add ARSession for Awareness Features
For awareness features you’ll need to create an ARSession. An ARSession configures which AR properties you want to enable, provides access to the AR system’s current world state, and lets you subscribe to AR events. You can create an ARSession as part of your scene initialization, for example, in the Start()
method of a script attached to a game object in your scene. Alternatively, you can use various AR feature managers to configure an AR Session. For more details on creating ARSessions, see Creating an AR Experience.
Optional: Add the ARDK-Examples Package
The ARDK-Examples package provides several example scenes and prefabs that you might be able to use as a starting point. You can import this package via Assets > Import Package > Custom Package and select the ardk-examples-(version).unityproject file you want to use. Import this package after you’ve successfully imported the ARDK in your project.
Download the ARDK-Examples package from the ARDK Downloads page.
Optional: Install the AR Voyage project
AR Voyage: A Lightship Experience is a hands-on look at the immersive AR experiences you can create using the Niantic Lightship AR Developer Kit (ARDK).
Download the ARDK and Generate an API key if you have not done so.
Download the AR Voyage project from the Lightship Developer Portal.
Unzip the tar file to create an ARVoyage folder and place that folder where you want ARVoyage to reside.
Load the project in Unity Hub.
In the Projects section, next to the Open button, click the drop-down and select Add project from disk.
Select the ARVoyage folder.
Set the Editor Version to 2020.3.33f1.
Open the project in the Unity Editor by selecting ARVoyage and click Open.
If you are prompted to enter Safe Mode or Ignore, choose Ignore.
Add the ARDK package to the project.
Open the Build Settings from the File menu and choose iOS or Android as your platform. (For Android, you may need to upgrade Gradle, see Building for Android API level 31 with OpenCL).
Restart Unity.
Optional: Decide Which Unity Input System to Use
ARDK supports both the Unity Input Manager and the Unity Input System for capturing user input, so you can configure your Unity project to use the system you prefer. If you want to use the Unity Input System, you’ll need to follow Unity’s instructions to install the Input System package in your project. If you want to use the Unity Input Manager, you don’t need to install any additional packages and ARDK will work with your Unity project as-is.
Note
The ARDK-Examples package has not been updated to support the Unity Input System package. Avoid importing ARDK-Examples in projects that have the Unity Input System enabled, as this will cause build problems.
Configure Your Build Platform
ARDK currently supports building iOS or Android apps. Choose iOS or Android for your Unity build platform and configure your Unity build settings for iOS or Android as described in Building for iOS and Building for Android.
Next Steps
Congrats, you’re now able to develop AR experiences in Unity using the ARDK. Next, dig into some of the fundamental concepts of the ARDK, such as:
Using Managers Learn about how to use ARDK managers to configure and access ARDK features.
Subscribing to ARDK Events Understand how to subscribe to ARDK events.
Validate Device Requirements Learn how to check for AR device capabilities at run-time.
Shared AR Learn how to create a shared AR experience for multiple users.
Once you’re familiar with the ARDK fundamentals, try some of the tutorials, browse the rest of the ARDK User Manual to learn how to work with advanced ARDK awareness and networking features, and review the ARDK samples.
Onboard with Lightship Guides. Learn how to develop with the ARDK through in-depth walkthroughs and videos.
Also, check out additional ARDK video walkthroughs and tutorials available in the Lightship AR YouTube channel.
If you’re new to Unity, you might find the resources at Unity Learn helpful.