How to Use Samples

Preparation

Prepare Unity Environment

Read Platform Requirements to learn system and Unity versions EasyAR Sense Unity Plugin support and get Unity packages from the Unity website.

If it is your first time, suggest using LTS Releases from Unity.

Prepare Package

Get latest EasyAR Sense Unity Plugin package from download page. Samples are included in the package. Please reference Plugin Introduction for the file to download and contents inside the downloaded file.

Get Licensing

Before using EasyAR Sense, you need to register on www.easyar.com and get a license key .


Editor Project Configuration

Create Empty Unity Project

Choose 3D, Core template When create a project. If you are using URP (default in Unity 6), you need to reference Universal Render Pipeline (URP) Configuration for Configuration.

../_images/image_s1_1.png

Add Plugin Package

The plugin use Unity’s package to organize itself. It is distributed as a tarball file. You will get readme files and a tgz file after extracting the downloaded zip file. Do not extract the tgz file.

../_images/image_s0_3.png

Note

It is suggested to put above tgz file inside the project, like in the Packages folder. Use Unity’s Package Manager window to install the plugin from a local tarball file.

../_images/image_s0_1.png

Choose the com.easyar.sense-*.tgz file in the popup dialogue.

Note

The tgz file cannot be deleted or moved to another place after import, so it is always a good practice to find a suitable place for the file before import. If you want to share the project with others, you can put the file inside the project and your version control system.

Import Sample(s) into Project

The samples are distributed within the plugin package. You can import samples into your project using Unity’s Package Manager window.

You can import all samples together using **All Samples**, or import individual sample with the sample name.

../_images/image_s1_5.png

Note

**All Samples** cannot be imported together with any other individual samples to the same project, there would be duplicate assets and cause scene asstes missing otherwise. Please delete all imported samples and import again if duplicate samples were imported by mistake.

Setup EasyAR Project

Fill in License Key.

Choose EasyAR > Sense > Configuration from Unity menu and fill in the License Key in the Project Settings. This page can be also opened from Edit > Project Settings > EasyAR.

../_images/image_s1_2.png ../_images/image_s1_3.png

Some samples use EasyAR services and service configurations are required. Skip if these samples are not used.

Above simple configuration is enough if this is your first time using EasyAR. For more configuration, Please reference EasyAR Settings.

Add scenes

Open Build Settings or Build Profiles,

../_images/image_s1_4.png ../_images/image_s1_6.png

Add sample scenes of the Unity project into Build Settings or Scene List in Build Profiles. Move the launcher scene (AllSamplesLauncher) to the top if there is a one in the project.

../_images/image_s1_7.png ../_images/image_s1_8.png

Do not add samples for HMD if running on mobile phones, build will fail otherwise:

  • Combination_BasedOn_AppleVisionPro.rst

  • Combination_BasedOn_Xreal.rst

../_images/image_s1_14.png

Run in the Editor

If you have AllSamplesLauncher scene, you can open it (double click scene file or use File > Open Scene) and it can launch all samples. Or you can choose to open (double click scene file or use File > Open Scene) a single sample scene to run.

../_images/image_s1_9.png

If a camera is connected to the computer, it can run EasyAR Sense Unity Plugin samples from Unity Editor after the above configurations.

../_images/image_s1_12.gif

Note that not all features can run in the editor using cameras. Some of them can only run on Android or iOS devices. Dialogue for session start fail message will popup when running these samples in the editor.

../_images/image_s1_15.png

And there will be UI messages and error logs,

../_images/image_s1_13.png

Note

Algoth these samples cannot run in the editor using cameras, but you can run in the editor for many of them (like SpatialMap samples) using pre-recorded eif files for simulation. Please refernece EasyAR Input Frame (EIF) Recording and Playback and Session Validation Tool for details.


Run on Android or iOS Devices

Configure the project according to Android Project Configuration or iOS Project Configuration, switch to target platform and then click on the Build or Build And Run button in Build Settings or use other alternatives will compile the project and install the binaries on the phone. Permissions should be granted on the phone when running.

../_images/image_s1_10.png ../_images/image_s1_11.png