Develop your first AR app with Wikitude SDK in Unity 3D

Vishnu Sivan
4 min readJun 20, 2022

--

Wikitude is an AR SDK used to build more immersive augmented reality and solutions. It supports use cases that require image recognition and tracking technology. The new version of SDK introduces some advanced AR features that can be used with external libraries such as ARKit and ARCore or as a stand-alone tool.

Features of Wikitude’s SDK 9.0 Expert Edition include:

  • High-end Image Tracking
  • Cylinder Tracking
  • Object Tracking
  • Multiple Trackers
  • Support for AR Foundation from Unity
  • Object visualization in Unity Editor

In this session, We are trying to set up the basic Wikitude demo that was given by the Wikitude team in Unity 3D.

Getting Started

Download Wikitude SDK Professional Edition for Unity from the official website. [Download]

The archive includes a pre-configured project with samples and an Unity package of the SDK. We can directly run the app from the Example/WikitudeUnityExample folder. Also you can try it with the help of unitypackage. You don’t need to do both. Just open the example project or create a new project and import the SDK.

1. Import Wikitude SDK

The wikitude unitypackage can be imported through Assets -> Import Package -> Custom Package. then select the downloaded Wikitude.unitypackage and click open. Click on Import to import all components into the project.

Instead of this, you can directly open the Example/WikitudeUnityExample in Unity 3D to setup your Wikitude demo.

2. Generate and add your License Key

You can generate a trial license from the licenses page. The site will be automatically redirected to the page when downloading the SDK.

https://www.wikitude.com/licenses/

You can add Wikitude license key in two ways. First one is to paste the license key into the license key field in the WikitudeCamera prefab.

Another way is to set the license key via adding WikitudeLicenseKeyin the sample scene controller script's Awake() method.

private void Awake() {
FindObjectOfType<WikitudeSDK>().WikitudeLicenseKey = "YOUR_KEY";
}

Ensure that the package name should be set in the Publishing Settings tab.

3. Build your app

Add all the sample scenes in the build settings window and set Main Menu scene as the first scene. then switch your platform to android and click on Build.

For Unity 2019+

Unity 2019+requires gradle build tools version 3.6.0 or later to build the application. So, the developer have to make some adjustments in the custom gradle file to make it works.

  • Go to Preferences > External Tools > Android > Gradle, and set the custom Gradle to Gradle 5.6.4 or later. If you are already having it then skip the step.
  • Go to Project Settings -> Player -> Publishing Settings -> Build, and select both gradle files: Custom Main Gradle Template and Custom Launcher Gradle Template.
  • Apply the following changes to both generated files: Assets/Plugins/Android/mainTemplate.gradle Assets/Plugins/Android/launcherTemplate.gradle
  • Remove the following comment from the gradle files, if present:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
  • Insert the following lines at the top of the file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}

There you have it! Your own AR app using Wikitude in Unity 3D :)

Thanks for reading this article.

If you enjoyed this article, please click on the clap button 👏 and share to help others find it!

The full source code of the project in the article is available on

--

--

Vishnu Sivan
Vishnu Sivan

Written by Vishnu Sivan

Try not to become a man of SUCCESS but rather try to become a man of VALUE

No responses yet