PhantomEngine-Logo-Icon-W-Text.png

Docs

Docs       Manual       Reference       Changelog       Main Site

Manual

Manual Setup Guide.

This guide provides step-by-step instructions to implement the PhantomEngine Unity SDK.

info.png

Before starting with setup, you’ll first need a Unity project to import the SDK into. 

We recommend using versions of Unity 2020.3.7 or later. Previous versions of Unity may not be compatible.

Importing the Package

As a .unitypackage

  1.  First, download the .unitypackage for the SDK from the PhantomEngine website.
     

  2.  Open your target Unity project.
     

  3.  Open the .unitypackage file by double-clicking it. This will open a dialogue window in Unity.
     

  4.  Select “Import”.

 

Please allow a few moments for Unity to import the SDK. 

You can then find the SDK’s files in the Assets folder of your project.

Change the location of the "StreamingAssets" folder from Assets -> PhantomEngine-Runtime to Assets.

Installing Dependencies

​PhantomEngine has 3 dependencies necessary for AR functionality. ARCore XR Plugin, ARKit XR Plugin and AR Foundation. They need to be manually added. To do so:

  1.  Navigate to Window -> PackageManager.
     

  2.  In the top left corner of the newly opened window, select Packages -> Unity Registry.
     

  3.  Search for AR Foundation, collapse it’s dropdown menu and select version 4.2.
     

  4.  Search for ARCore XR Plugin, collapse it’s dropdown menu and install version 4.2.1.
     

  5.  Search for ARKit XR Plugin, collapse it’s dropdown menu and install version 4.2.1.

Configuring Dependencies

Once the necessary dependencies are installed in your Unity project, the following configurations need to be made:

  1.  Navigate to Edit -> Project Settings.
     

  2.  In the bottom left corner of Project Settings, select XR Plug-in Management.
     

  3.  Select Android Settings and enable ARCore.
     

  4.  Select Player in Project Settings,
     

  5.  Under Player, select Android Settings,
     

  6.  In Android Settings, navigate to Other Settings, Graphics APIs.
     

  7.  Remove Vulcan, and add OpenGLES3.
     

  8.  Under Player, navigate to Minimum API Level, and select API level 24 or above.
     

  9.  Under XR Plugin Management, enable your supported XR Plugins for each supported platform. (For example, ARCore for Android, and ARKit for iOS).

Setting Up a Basic Scene in Unity

The PhantomEngine SDK comes with a sample scene preconfigured for development, however the situation may arise where you need to set up your own scene.

To do this, first right click in the project window and select Create -> Scene. Give the scene a name, then open it for editing.

Setup AR Foundation

  1.  Create a GameObject called “ARFoundation
     

  2.  Right Click on ARFoundation in the Hierarchy and add XR-> AR Session and XR->AR Session Origin.
     

  3.  Collapse AR Session Origin and select its child GameObject AR Camera.
     

  4.  On the AR Camera GameObject, add a Scanning Component and change its Tag to MainCamera.
    This can be found by clicking the “Add Component” button and navigating to PhantomEngine -> Spatial Mapping -> Scanning.

UnityMenu.JPG
Unity2.JPG

Setup PhantomScene

  1.  ​Create a GameObject called “PhantomScene”.
     

  2.  Select the object and through the Inspector, select Tag -> Add Tag. Name your new Tag PhantomScene” and assign it to PhantomScene GameObject.
     

  3.  On the PhantomScene GameObject, add a PScene component.
    This can be found by clicking the “Add Component” button and navigating to PhantomEngine -> Scene Management -> Phantom Scene.
     

  4.  Assign the PScene References by clicking on the bullseye symbol on the right side of the field and selecting the available scripts and GameObjects, which should all derive from ARFoundation’s children.
     

  5.  Add a child GameObject to the PhantomScene GameObject called “Scan”, and add the “MeshingComponent to it.
    This can be found by clicking the “Add Component” button and navigating to PhantomEngine -> Spatial Mapping -> Meshing.

Unity3.JPG

Setup Phantom Settings

  1.  Create a GameObject called “PhantomSettings
     

  2.  On the PhantomSettings GameObject, add a PhantomSettings Component.
     

  3.  On the PhantomSettings Component, you will need to attach parameters for the various settings fields. Click the bullseye symbol on the right of the field and select the Module Parameters you’d like to use.
     

  4.  You can further customize specific Module Parameters in the Inspector by selecting them in the Project Explorer. They can be found in Packages -> PhantomEngine -> Runtime -> Resources.

Unity4.JPG

Putting it All Together

You can now build the scene from File->Build Settings… :

  1.  Add the Scenes you want to build.
     

  2.  Specify the Platform you want to build on. 
     

  3.  Select Build and Run.
     

  4.  On your device, allow your application to access the Camera.

And that’s it! You have successfully built the sample application.