Unity

Our Unity package allows you to use Zappar's best-in-class AR technology with content built using the Unity game engine.

Importing the Package

You can import the Zappar package directly from the editor by following these steps:

  1. Open the Package Manager from the Window>Package Manager in the editor interface.
  2. Locate the + button on top-left corner and select Add package from git URL...
  3. Enter the following URL: https://github.com/zappar-xr/universal-ar-unity.git


This will automatically fetch the latest version of the package from Github.

You can also define the universal-ar-unity package as a dependency in your projects' manifest.json file located under Root_Directory>Packages.

{
  "dependencies": {
    "com.zappar.uar": "https://github.com/zappar-xr/universal-ar-unity.git"
  }
}

You can modify the source github URL to define any particular tag or branch by adding suffix: #ID to the git URL. You can read more about it here.

Usage

Once the package has been successfully imported, the Universal AR package will appear in your Packages/ project directory.

The package includes:

  • A set of prefabs to get you up and running quickly.
  • A set of scripts that power those prefabs.
  • Supporting materials and shaders.
  • Supporting libraries for iOS, Android and WebGL build platforms.
  • Support for Unity Scriptable Render Pipeline (SRP).
  • A new 'Zappar' menu entry.

The Zappar menu entry (found along the top-level toolbar) has Zappar context specific components and utilities for ease of use. From here you can view helpful utilities, add the Zappar Camera, Tracking Types and access the specific Universal AR Settings.

Zappar Menu Entry

To get started, remove the default camera then add a Zappar Camera, Tracking Type and your content.

Scriptable Render Pipeline (SRP)

In order to use the Universal AR SDK with Unity SRP, you'll need to update the Zappar editor settings. This setting are accessed from Zappar menu - Editor/Update Project For SRP.

SRP

The setting adds an additional scripting symbol ZAPPAR_SRP to the Unity project, which updates the internal Zappar pipeline to support SRP rendering events. If you were previously using the Standard Pipeline, you can update the existing scene from the Editor/Update Zappar Scene For SRP menu. This option updates the camera settings.

If you have any missing materials/shaders in the scene or while adding new Zappar asset (for example, Zappar/Face Tracker), you can find the appropriate material reference from examples scene.

Importing Examples

To get started quickly or to get some inspiration, we have a number of example projects that can be imported directly into Unity. To import these example projects, go to the Package Manager. Change the dropdown menu to In Project and you'll see an additional Zappar option.

Importing Example Projects

You should select either one of the two samples available, depending upon whether or not you are using Unity SRP.

Zappar Universal AR Settings

You can access additional project level settings of Universal AR from Zappar/Editor/OpenUARSettings.

Universal AR Settings

The settings currently include options to enable/disable image preview for image tracking and some debugging options.

Zappar Image Training

You can train a new image into a target image (.zpt file) by opening the Zappar Image Trainer window and going to Zappar/Editor/Open Image Trainer. We recommend setting default parameters for the first use of the image trainer but please note that you will need to enable ZPT Overwrite explicitly if the file already exists under StreamingAssets. You can also decide not to include an image preview with your .zpt file to minimize your build size.

maxWidth and maxHeight refer to the training model parameters and won't resize your source or preview image. We recommend keeping it unchanged for optimum usage.

Zappar Image Trainer

While the prefabs included with the assets allow you to quickly build augmented reality experiences, the library also provides a rich API that you can use if you require greater control of the computer vision libraries. See the articles below for more information:

zapcode branded_zapcode i