Vuforia AR with Unity

Getting Started with Vuforia.

Vuforia Core Samples Guide

This guide is for Unity developers getting started with the Vuforia Core Samples from the Unity Asset Store.

The Vuforia Core Samples package contains a selection of complete AR scenes to get you started developing for handheld and headworn devices running Android, iOS, and UWP. Each scene implements a feature of the Vuforia Engine, showing how to design and configure a Unity scene to track a broad range of images and objects, as well as your environment. You can easily add your own assets to these scenes, to create customized AR experiences.

This guide will cover how to:

  • Import the Vuforia AR Starter Kit listed as Vuforia Core Samples

  • Evaluate the sample scenes in Play Mode

  • Add your own content to create custom AR experiences

  • Adding your own targets to the samples

Getting Started

Download the Vuforia AR Starter Kit

Download the Vuforia Core Samples package from the Unity Asset Store. Select Open In Unity to add it to a new or existing Unity project.

When the package manager lists the assets in the Core Samples package, click Import to add all of the package contents to your open project..

Working with the Vuforia Core Samples

The AR Starter Kit includes scenes that show how to use the following Vuforia Engine features:

Printing Targets

The following sample scenes use printed images. You can find PDF versions of these images that are ready to print in the Editor/Vuforia/ForPrint folder.

Running a Vuforia Scene in Play Mode

1. Open the SampleScenes folder and double click on the scene you want to play
2. Press the Play button at the top of the Unity Editor window or CMD+p (Mac)/CTRL+p (Win).

Vuforia Engine's Play Mode enables you to use a webcam to view an AR scene in Unity. You can use the default webcam for your computer, or configure Play Mode to use a peripheral webcam by selecting this option in the ARCamera's WebCamBehaviour component.Here is an example of what you will see when running the ImageTargets scene in Play Mode

Building the sample scenes

1. Click on the SampleScenes folder2. Select File > Build Settings
3. Drag the scenes you want to build from SampleScenes into the Scenes In Build window

Be sure to add the Splash, Menu, and Loading scenes to Scenes In Build. These are needed to navigate across the sample scenes.

4. Select the Platform that you are building for and configure any build settings you want to use and then build your app.

Vuforia Engine supports Android, iOS, and Windows Store apps

Adding your own content

It is very easy to customize the sample scenes. Simply add your digital content as a child of the target it should be associated with. This will cause the content to be rendered when the target is recognized and to follow the target within the field of view of the camera. All of Vuforia Engine's features use this same convention when authoring scenes in Unity.

Example: ImageTargets

The teapot model is a child of the Stones ImageTarget. When the Stones target is detected, the teapot will be rendered, and will move with the target in the camera's field of view.

 

Adding your own targets to the sample scenes

You can create targets, manage target assets, and generate target databases in the Target Manager.  The Target Manager is a web based tool available to registered Vuforia Engine developers.

To access the Target Manager, register and retrieve a free license key using the steps outlined below. You can then start creating custom targets.

Register for Vuforia Engine

If you are not already a Vuforia Engine developer, you will first need to create a Vuforia Engine Developer Account.

Get a Free Development License Key

1. Login and navigate to the License Manager on the Vuforia Engine Developer Portal then select Add License Key.2. Select the Development project type

The Development license is free to try. If you distribute your app, you will be required to purchase the appropriate consumer or enterprise plan.3. Provide a name for your app

4. Press Next then confirm your selection on the next page5. You'll see your app listed in the License Manager. Click on it.7. Your app’s license key is shown in the License Key field – copy it.

You’ll need to paste this key into your Unity project.

Adding a License Key to Your Project

In Unity, your license key should be added to the App License Key field on the VuforiaConfiguration asset which is accessible from the ARCamera's Inspector panel via the Open Vuforia Configuration button. You can also search for VuforiaConfiguration in the Project panel.

Previous
Previous

Complete C Unity Developer 3D: Learn to Code Making Games