# Building from the Source Code

To build the sample app directly from the source code (.zip) provided in the release, follow the below steps.

## **Get the ARwayKit SDK** Source Code

Download the .zip from our [GitHub](https://github.com/arway-ai/unity-viewer-sdk/releases). Please [contact us](https://www.arway.ai/contact) for access.

## Prerequisites

In this guide, we will be using the following versions of Unity:

* **Unity:** 2022.3.62f3
  * Include the following platforms in your Unity install:&#x20;
    * Android Build Support&#x20;
      * OpenJDK
      * Android SDK & NDK Tools
    * iOS Build Support

## **Implementation**

In the instructions below, we will be using the provided .zip source code to create a new app. If you already have an existing Unity app to which you wish to add the package, please refer to the instructions provided in the link below.

{% content-ref url="quickstart-in-unity" %}
[quickstart-in-unity](https://docs.arway.ai/arway-sdk/quickstart-in-unity)
{% endcontent-ref %}

### Getting the Account ID and Secret Key

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

<figure><img src="https://4128853559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlDytDSBRx8P4ZZXD57DA%2Fuploads%2FJu8eWIZGmYcfox7u5qyl%2F9FyMWaoEPl.png?alt=media&#x26;token=81fda761-7ae0-4e6c-824a-85cb6f8c3477" alt=""><figcaption><p>The "For Developers" page of the Creator Portal</p></figcaption></figure>

### **Opening the Project in Unity**

1. Download the .zip file source code for the latest release.
2. Extract the .zip file to a new folder.
3. Open Unity Hub, and click "Add" > "Add project from disk" and select the extracted zip file.
4. Open the project using Unity Editor Version **2022.3.62f3**.

### **Adding the Account ID and Secret Key**

1. In the Project Window, go to "Assets -> ARway -> Viewer Mode -> Resource-> ARWayKitConfig " and add your credentials for the Account ID and Secret Key.

<figure><img src="https://4128853559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlDytDSBRx8P4ZZXD57DA%2Fuploads%2FdW8rwkubF3zq4lAMJ1j4%2Fimage.png?alt=media&#x26;token=e121d95c-e745-45eb-b60e-212dded7bb83" alt=""><figcaption><p>AR Way Kit Config</p></figcaption></figure>

### **Switch Build Platform to** Android or iOS.

1. "File -> Build Settings -> Build -> Select iOS/Android"

### **Updating the** Addressables Groups

1. Navigate to "Window -> Asset Management -> Addressable -> Groups".
2. In the Addressables Groups window, click on "Build -> New Build -> Default Build Script".

{% hint style="info" %}
When making any changes that affect localization strings, you will need to update the Addressables Groups.
{% endhint %}

### Android Build Signing

When building for Android, Unity requires a keystore to sign the application.

1. Go to **Project Settings > Player > Android > Publishing Settings**.
2. Under **Custom Keystore**, you have two options:
   * **Use your own keystore**: If you have a production key (recommended for release builds), set the path to your `.keystore` file and provide the alias, password, and key details.
   * **Use the debug key for testing**: If you don’t need a custom key (e.g., for local development or quick testing), uncheck **Custom Keystore**. Unity will then sign the app automatically with the default debug keystore.

**Important**:

* A debug key is fine for testing, but **Google Play requires your app to be signed with your own keystore**. Make sure to generate and securely store a keystore for release builds.

### Building the App

1. In Unity select "File -> Build Settings".
2. Ensure the following scenes are selected in the following order:

   * ARWay/ViewerMode/0\_Scene/Dashboard-SDK
   * ARWay/ViewerMode/0\_Scene/ARMapSession

   <figure><img src="https://4128853559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlDytDSBRx8P4ZZXD57DA%2Fuploads%2FYyBW4ninGOoBbdDJrls6%2Fimage.png?alt=media&#x26;token=32c6166f-801f-4c03-8a02-dadfd88702b1" alt=""><figcaption><p>Build Settings Window</p></figcaption></figure>
3. Change the platform to either Android or iOS by selecting "Android or iOS -> Switch Platform".
4. Select "Build and Run" to run the app.
   1. If you see a pop-up for "Unsupported Input Handling" click "Yes"

After successfully building the app on your device, you can scan QR codes that you created for your ARway maps in the Creator Portal.     &#x20;

&#x20; &#x20;

<figure><img src="https://4128853559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlDytDSBRx8P4ZZXD57DA%2Fuploads%2F31W83RxBtV3LDeLN7lvp%2FUnity_Uwc6YpfxS6.jpg?alt=media&#x26;token=cd58df7b-2786-4730-b178-212e7f7d3072" alt=""><figcaption><p>Dashboard scene</p></figcaption></figure>
