N
N
NRSDK
Search…
Getting Started with NRSDK
Start developing your NRSDK Unity apps on Android phone.
This quickstart guide will help you set up your development environment and test out the sample app “Hello MR” on NRSDK.

1. Requirements

Hardware Checklist
  • An Nreal Computing Unit / Supported Android Phone. Think of Computing Unit as an Android phone with no screen, so all development processes will be very similar to an Android phone. Please review the Device Compatibility to ensure your phone model is well prepared.
  • A pair of Nreal Light glasses
  • Android Debug Bridge (adb) debugging and testing through Wi-Fi is not necessary, but is strongly recommended, so as to avoid frequent plugging in and out Nreal glasses from your phone and connecting the phone to the computer.
  • (Optional) A USB-C cable to connect the Nreal computing unit to your PC
Software Checklist
  • Unity 2018.4.X or later with Android Build Support. Unity LTS (Long Term Support) version is recommended
  • Latest NRSDK for Unity
    The SDK is downloaded as NRSDKForUnity_1.8.0.unitypackage
  • Android SDK 8.0 (API Level 26) or later, installed using the SDK Manager in Android Studio
  • Visual Studio (if you prefer other development environments that’s fine too)

2. Creating a Unity Project

We’re going to create a new Unity project and integrate NRSDK later on. To create a new Unity project:
  • Open Unity Hub and create a new 3D project.
  • Skip the following three steps If your Unity version is later than 2018. For Unity 2018:
    1. 1.
      Navigate to “File” -> “Build Settings”
    2. 2.
      Set Player Settings>Other Settings>Scritping Runtime Version to .net 4.x equivalent
    3. 3.
      Close the “Build Settings” tab
  • Import NRSDK for Unity
    • Select Assets>Import Package>Custom Package.
    • Select the NRSDKForUnity_1.8.0.unitypackage that you downloaded.
    • In the Importing Package dialog, make sure that all package options are selected and click Import.

3. Configure Project Settings

You could either configure your project automatically via NRSDK Project Tips tool or configure manually. These two ways are equivalent.

Project Tips tool

  • Go to NRSDK -> Project Tips in Unity menu
  • Click Accept All in the popup window
  • Wait for Unity to process. The Project Tips window should appear as empty when finished.
  • Close the Project Tips window

Manual Configuration

  • Go to File > Build Settings.
  • Select Android and click Switch Platform.
  • In the Build Settings window, click Player Settings.
  • In the Inspector window, configure player settings as follows:
Setting
Value
Player Settings > Resolution and Presentation > Default Orientation
Portrait
Player Settings > Other Settings > Auto Graphics API
false
Player Settings > Other Settings > Graphics APIs
OpenGLES3
Player Settings > Other Settings > Package Name
Create a unique app ID using a Java package name format. For example, use com.nreal.helloMR
Player Settings > Other Settings > Minimum API Level
Android 8.0 or higher
Player Settings > Other Settings > Target API Level
Automatic (highest installed)
Player Settings > Other Settings > Write Permission
External(SDCard)
Project Settings > Quality > V Sync Count
Don't Sync

4. Configure Compatible Devices

You could specify Target Devices in Assets/NRSDK/NRProjectConfig. Be aware that all the NRSDK features supported by Nreal Air are supported by Nreal Light . By default, Both Support Nreal Light and Support Nreal Air are selected.
By selecting Nreal Air, NRSDK will automatically attemp to adapt to Nreal Air even if you had implemented NRSDK features that are based on RGB Camera (plane detection, image tracking, hand tracking, recording, etc. See Device Compatibility for details). However, be aware that the actual behavior of the adapted application may differ from your initial intent.
If you only want the application to run on a specific device (Light/Air), you may arbitrarily specify a single target device. In this way, NRSDK will not try to adapt automatically, and the app will not be running on unsupported devices.

5. Configure AR Features

  • Find and click Assets/NRSDK/NRKernalSessionConfig in Unity project folder, make sure the plane tracking, image tracking is configured properly as the following default configuration:
Please note that Plane Finding Mode and Image Tracking Mode will implicitly be Disable when Support Nreal Air is selected in Step 4: Configure Compatible Devices, regardless of your configuration here in the inspector.

6. Find Hello MR Sample Scene

  • Find the HelloMR sample scene in the Unity Project window by selecting Assets > NRSDK > Demos > HelloMR.
  • Double click HelloMR to open the scene

7. Building NRSDK App for Android

  1. 1.
    Access the Build Settings in Menu -> File -> Build Settings. Make sure the current scene is checked.
2. Click Player Settings. Customize the Company Name and Product Name.
3. (Optional) Navigate to the Android> Other Settings panel to specify your build settings. As you have prepared Step 3. Configure Project Settings, you may leave the current configuration as it is. It is worthnoting some of the other settings:
  • Multithreaded Rendering: Enable this option to use multithreaded rendering. In most cases, both enabling and disabling this option is supported by NRSDK. However, fore the scenes that contains Overlay content, you should disable multitreaded rendering
  • Scripting Backend: choose either IL2CPP or Mono, but you can only choose IL2CPP when building for ARM64 architecture.
4. In Build Settings window, click Build
5. Select the destination folder and wait till the buidling is finished.

8. Deploy to Nreal Device

  • Connect your Phone / computing unit to your Mac / Windows PC.
  • Install your app through WiFi Android Debug Bridge (adb) or type-C cable after the build is successful.
  • Disconnect the computing unit with your PC, and then connect it to the glasses.
  • (Computing Unit only) If it is the first time you run this app, you need to authrize the app by some tools like scrcpy.
  • Launch you app along with the Nreal Light controller. For instructions on how to use the Nreal Light controller, please refer to Controller.
  • Move around until NRSDK finds a horizontal plane and the detected plane will be covered with green grid.
  • Click the Trigger button to put an Nreal logo object on it.
  • (Optional) Use Android Logcat to view logged messages. We recommend using WiFi Android Debug Bridge (adb) to connect to your PC so that you do not have to be connected through the data cable most of the time.
  • Enable developer options and USB debugging on your Phone / Computing unit. Android Debug Bridge (adb) is enabled as default and does not require manual setting.