Skip to main content

Setting Up the Niantic SDK for Unity

To set up the Niantic SDK for Unity, you will need to:

  1. Create an Account
  2. Download and install the Unity Hub and the Unity Engine
  3. Install the Niantic SDK Unity packages
  4. Authenticate Niantic SDK in Unity
  5. Activate the XR Loader for your platform
  6. Configure Unity for the platform your AR experience will run on
  7. Set up a basic Unity AR scene

Create an Account

Before getting started with the NSDK setup, it is highly recommended to create an account since a couple of steps will require one.

You can find our guide to walk you through creating an account here.

Download and Install Unity

In order to install the Unity 3D Engine you must first install the Unity Hub which gives you access to the latest versions of the currently supported engines.

NSDK only supports Unity LTS and, as of the time of writing, officially supports Unity 6000.0.58f2 and Unity 2022.3.62f2. If you no longer see those engine versions in the Unity Hub downloads window, you can locate them by going to the download archive.

Attention!

You may notice that you can use any version of 6000.0.x and 2022.3.x and be okay. However, we have noticed in the past that some of these patch updates performed on the engine can introduce conflicts with NSDK. For maximum compatibility it’s recommended to stick to the versions mentioned above.

Create a Project and install the Niantic SDK Packages

Create a Project and Install NSDK

  1. Create a new Unity project with the 3D (Built-In Render Pipeline) template. Alternatively, if planning to use Unity's Universal Render Pipeline select the Universal 3D (Core) template.
Attention!

If you are using or plan to use the Universal Render Pipeline (URP), refer to How to Set Up NRDK with the Universal Render Pipeline for additional setup instructions.

  1. In your Unity project, open the Window top menu, then select Package Manager.
  2. From the plus menu on the Package Manager tab, select Add package from git URL....

    Package Manager menu

  3. Enter https://github.com/niantic-lightship/ardk-upm.git.
    1. If prompted, click Yes to activate the new Input System Package for ARFoundation 5.0. This may require a restart of the Unity Editor.
  4. To add the SharedAR package, repeat these steps using the following URL instead: https://github.com/niantic-lightship/sharedar-upm.git.

To use a specific ARDK version, download its .tgz from our release pages (ardk-upm, sharedar-upm). Then, follow the installation instructions above and select "Add package from tarball" instead of the Git URL.

Authenticate Niantic SDK in Unity

  1. Authenticate with API Key
    1. In Unity, navigate to the top menu bar and select the Lightship tab, then select Settings to open the Lightship Settings menu.
    2. Click on Get API Key under Credentials. This should open the lightship.dev website in a browser window.
    3. Log into your Lightship account or create an account if you haven't done so
    4. Open the Projects page, then select an existing project or create a new one by clicking New Project.
    5. In your project's Overview, copy the API Key by clicking the copy icon next to it.
    6. Back in Unity, return to the Lightship Settings and paste your API Key into the API Key field.

Activate the XR Loader for Your Mobile Platform

Attention!

In Unity versions 2022.3.10f1 or newer, you might see a benign error in the console after following these steps.

  1. Open the Lightship top menu, then select XR Plug-in Management.
  2. In the XR Plug-in Management menu, select the Android tab, then check the box labeled Niantic Lightship SDK + Google ARCore.

Configure the Build Platform

  1. Open the Build Profiles window by selecting File > Build Profiles.
  2. Select iOS or Android, then click Switch Platform. After the progress bar finishes, click Player Settings. Select your platform from the tabs, scroll down to Other Settings, and change the following settings:
  • Rendering - Uncheck Auto Graphics API. If Vulkan appears in the Graphics API list, remove it.
  • Identification - Set the Minimum API Level to Android 7.0 'Nougat' (API Level 24) or higher.
  • Configuration - Set the Scripting Backend to IL2CPP, then enable both ARMv7 and ARM64.

Next Steps

Setting Up a Basic AR Scene

To get started creating your own AR project, begin by creating an empty AR scene:

  1. Create a new Basic scene:
    1. From the main menu, choose File > New Scene.
    2. Select Basic (Built-in) and click Create.
  2. Right-click on the Main Camera and select Delete.
  3. Add an ARSession and XROrigin to your new scene
    1. Select the new scene in the Hierarchy.
    2. From the main menu, select Game Object > XR > AR Session.
    3. Repeat to add an XR Origin (Mobile AR).
  4. Save the scene using File > Save.
tip

If you choose Save As Scene Template, you can select this scene in the New Scene dialog next time.