Links
Comment on page

Integrating the Unity Package

Add the ARwayKit Unity package to an existing Unity Project
Follow these steps to add the .unitypackage to an existing Unity app.

Get the ARwayKit SDK .unitypackage

Download the .unitypackage from our GitHub. Please contact us for access.

Implementation

In the below instructions, we will be creating a new project in Unity, skip the step for creating a new project if you already have an existing Unity codebase.

Getting the Account ID and Secret Key

  1. 1.
    From the ARway Creator Portal, go to "For Developers -> Create a New App -> Enter App Name".
  2. 2.
    Copy your Account ID and SecretKey for that App.
The "For Developers" page of the Creator Portal

Creating a new project in Unity

If you have an existing project in Unity, skip this step.
  1. 1.
    Open Unity Hub and click the "New project" button on the top right. Select the template "3D" and create your new project (Unity Version 2021.3.17f1).
Create a new project in Unity hub

Importing Packages

  1. 1.
    Open Unity Project and Go to "Assets -> Import Package -> Custom Package". Then select the ARwayKit SDK .unitypackage.
import ARwayKit SDK package in Unity
  1. 2.
    From the Package Manager, "Window -> Package Manager", add the following packages from the Unity Registry:
    • AR Foundation (4.2.8)
    • ARCore XR Plugin (4.2.8)
    • ARKit XR Plugin (4.2.8)
    • XR Interaction Toolkit (2.2.0)
    • Localization (1.3.2)
    • TextMeshPro (3.0.6)
      • Then import "TMP Essential Resources", from the "Window -> TextMeshPro -> Import TMP Essential Resources" menu option
    • GLTF Fast
      • Add from git URL: https://github.com/atteneder/GLTFast.git
Import all required packages

Build Settings

  1. 1.
    In "File -> Build Settings -> Player Settings -> Settings for Windows, Mac, Linux -> Other Settings" then check the box for "Allow 'unsafe' code", then restart the Unity Project (you may be prompted to do so).
Update Player settings
  1. 2.
    Open the two scenes, ARMapSession.unity and Dashboard.unity, from "File -> Open Scene -> Assets-> ARwayKitSDK -> SampleApp -> 0_Scene".
Add the scenes to the build settings from "File -> Build Settings" -> Add Open Scenes". Ensure that "ARwayKitSDK/SampleApp/0_Scene/ARMapSession" and "ARwayKitSDK/SampleApp/0_Scene/Dashboard" are both selected.
Update build settings with required scenes
  1. 3.
    In "File -> Build Settings -> Player Settings -> iOS Settings -> Other Settings" and modify the Bundle Identifier so that it is unique and matches the domain name of your organization in reverse order.
    • Disable Metal API Validation if it is enabled in the "Other Settings".
    • Uncheck "Multithreaded Rendering*".
    • Check "Requires ARKit support".
    • Enable "Identification -> Automatically Sign", then set the following usage descriptions.
      1. 1.
        Camera Usage Description*: Used for AR Content and mapping
      2. 2.
        Microphone Usage Description*: Used for creating audio content
      3. 3.
        Location Usage Description*: Used to attach maps with global coordinates and public map searching
Update player settings
  1. 4.
    For Android Only disable the Graphic API and remove the Vulkan.
    1. 1.
      Uncheck "Auto Graphics API"
    2. 2.
      Uncheck "Multithreaded Rendering*".
    3. 3.
      Remove "Vulcan" from the list of Graphics APIs.
    4. 4.
      Set Minimum API Level 24.
    5. 5.
      Change "Scripting Backend" to "IL2CPP".
    6. 6.
      Change "API Compatibility Level*" to " .NET Framework".
    7. 7.
      Uncheck "Apply display rotation during rendering".
    8. 8.
      Check Target Architectures for ARMv7 and ARM64.
Android specific build settings

XR Plug-in Management

Verify that the Plug-in Providers for both Android and iOS have been configured.
  1. 1.
    Navigate to "Edit -> Project Settings -> XR Plug-in Management."
  2. 2.
    Click on the Android icon. Confirm that "ARCore" is chosen, and ensure that "Initialize XR on Startup" is enabled.
    XR Plug-in Management iOS
  3. 3.
    Click on the iOS icon. Confirm that "ARKit" is selected, and ensure that "Initialize XR on Startup" is enabled.
XR Plug-in Management Android

Adding the Account ID and Secret Key

  1. 1.
    In the Project Window, go to "Assets -> ARwayKitSDK -> Resource-> ARWayKitConfig
" and add your credentials for the Account ID and Secret Key.
Add credentials in the ARway config file

Set Active Localization Settings

This app utilizes the Unity Localization package. On first build, you will need to set the active Locales.
  1. 1.
    Go to "Edit-> Project Settings -> Localization".
  2. 2.
    For "Active Settings" select the asset called "Localization Settings".
Localization settings
  1. 3.
    Set the "Project Locale Identifier" that will be the locale used by default, such as "English (en)".
Project Locale Identifier
  1. 4.
    Click "Add All" below Available Locales.

Updating the Addressables Groups

  1. 1.
    Navigate to "Window -> Asset Management -> Addressable -> Groups".
  2. 2.
    In the Addressables Groups window, click on "Build -> New Build -> Default Build Script".
When making any changes that affect localization strings, you will need to update the Addressables Groups "Build -> New Build -> Default Build Script".

Addressable Analyzers

As the SDK is loaded from the .unitypackage, the Addressable Group rules have been modified and the Addressable Analyzers will be used to resolve issues.
  1. 1.
    Open Addressable Analyzers in the Analyzer window "Window -> Asset Management -> Addressables -> Analyze".
  2. 2.
    Expand "Analyze Rules" and select "Fixable Rules".
Addressable Analyzers
  1. 3.
    Click the "Analyze Selected Rules".
  2. 4.
    After it analyzes click "Fix Selected Rules".

Building the App

  1. 1.
    In Unity select "File -> Build Settings -> Build -> Select iOS/Android -> Build and Run" to run the app.
Build Settings screen in Unity
After successfully building the app on your device, you can scan QR codes that you created for your ARway maps in the Creator Portal.