Building a Kin-powered app with Unity, Part 2

Will Gikandi
Kin Blog
Published in
5 min readJul 31, 2019

Getting Started

Getting Started

In Part 1 — What is Kin?, we went through the advantages of powering your app with Kin. In today’s module, we will go through the steps you need to take to get started on your road to building a Kin Powered App.

Skills Checklist:

To be able to follow the upcoming tutorials easily, you will need to have the following skills.

  1. C#: For use in Unity
  2. Windows/ Mac CLI: to set up your server.
  3. Node.js or Python : For using the SDK on your server

For now, we will simply go through setting up your environment.

Setting up your developer environment

Step 1: Download Unity Hub

Download and install Unity Hub here.

Unity Hub

Unity hub helps you easily manage your projects, and versions of unity installed. Once you have hub set up, you can use it to install the version of Unity you want.

Step 2: Install Unity and Android Build Support

Click on Installs, and then ADD the latest version of Unity.

Click NEXT and install the Android Build Support.

You can also add Visual Studio (recommended) if you do not have it on your system, although Unity works with other editors. For simplicity, this tutorial will cover creating an android app, but you can also add support for iOS. (The only difference with building for iOS is during compile time.)

Step 3: Create a New Project

Once Unity Hub has completed installing Unity and Android support, launch Hub again to create a new project.

Step 4: Create a Unity Account (free)

To install the Kin Unity SDK, you will need to have a Unity account. If you do not have one, simply register for one here.

Step 5: Install the Kin SDK for Unity

Open up Unity again and start your project.

Open up the Asset store tab by going to Window> Asset Store and search for the Kin SDK for Unity. You can also access it from your browser here.

Scroll down and click to import. Make sure all the tick-boxes are marked and wait for the process to complete. Unity may need you to log in to allow the import — Simply use the login details from Step 4 above.

You may see some notices in your console from the SDK. This is normal. This is just Unity letting you know that the SDK will only run on an Android or iOS device, and not on the editor. This is only relevant when testing your code, but we’ll get to that in later tutorials.

Step 6: Switch to Android Platform

Go to File > Build Settings and switch the platform to Android.

Step 6: Disable proguard

Proguard may cause some issues when compiling the Kin SDK. For now, we should disable it to prevent ClassNotFound errors during compile time.

On the same screen, select Player Settings and publishing settings. Make sure that Minify is set to None.

Step 7: Customize your Gradle file

A gradle is just a file that manages your Android compiles on Unity. To use the Kin SDK, we will need to add a few lines to your gradle. Before you close the player window, make sure Custom Gradle Template (green above) is checked. When you check it, Unity will create a custom file that we will edit.

Make sure Proguard stays unchecked for now. Close the windows you had opened up to go back to your unity project, and double click on the gradle file for the changes below.

You can use notepad or Visual Studio to edit it. Make sure the following lines are present in each section. Don’t worry about the **DEPS** lines you see. They are placeholders that Unity uses to manage dependencies.


allprojects {
repositories {
jcenter()
google()
maven { url 'https://jitpack.io' }
}
}


dependencies {

implementation 'com.github.kinecosystem.kin-sdk-android:kin-sdk-lib:1.0.5'
implementation 'com.github.kinecosystem.kin-sdk-android:kin-backup-and-restore-lib:1.0.5'

**DEPS**}


android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

Note 1: you gradle file may show:

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8}

This is also fine, and you can leave it as it is, without needint to add the compile options shown previously.

Note 2:

To make sure you are listing the latest version of dependencies in your gradle file, check Kin’s Github for details.

Conclusion

That’s it! Your environment is now ready to create and test a Kin app on Unity!

Our next tutorial, will cover the first calls to the Kin Unity SDK.

--

--