Getting Started
To get started, import the Strivr SDK Unity Package into your project via UPM (Unity Package Manager).
-
In Unity, go to Window → Package Manager
-
In the window that pops up, click the plus (+) icon in the status bar.
-
Click Add package from disk… to bring up a file browser
-
Navigate to the root of the com.strivr.strivrsdk folder that you downloaded.
-
Open the package.json file in the root folder.
Project Setup
Once the package is installed, you must first link your project before you can start tracking data.
-
In Unity, go to Strivr → Settings
-
In the window that pops up, you will see three fields that you need to fill out: Developer Tenant Id, Project Id, and API Key.
For each of the three fields, copy and paste the values that you received from Strivr. If you have any questions regarding this step, contact justin.cellona@strivr.com.
-
Once you fill out the three fields, click Link Account.
-
After your project is linked, you need to add Android dependencies to your project.
If you do not already have a file called mainTemplate.gradle in your project, you can create one by going to Edit → Project Settings…
Then, under Player → Android tab → Publishing Settings → Build, select the option that says "Custom Gradle Template" or "Custom Main Gradle Template". If it doesn’t already exist, this will automatically generate the mainTemplate.gradle file in the Assets/Plugins/Android directory.
-
Once this file is created, open it and copy and paste the following lines under the dependencies section. Then save the file.
implementation 'androidx.work:work-runtime:2.7.1' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
If present, remove the following comment at the top of the file:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
-
If you are using Unity 2020 or newer, you will have to explicitly enable AndroidX in your gradleTemplate.properties file. In the same window under Player → Android tab → Publishing Settings → Build, select the option that says "Custom Gradle Properties Template". If it doesn’t already exist, this will automatically generate the gradleTemplate.properties file in the Assets/Plugins/Android directory.
-
Once this file is created, open it and copy and paste the following line under the **ADDITIONAL_PROPERTIES** section. Then, save the file.
android.useAndroidX=true