🤳 Adding AR capabilities

Learn how to add AR capabilities to your cloud-connected Unity project.

Now that you are successfully able to stream 3D content into Unity and know how to make custom adjustments, its time to add AR capabilities to your project.

Unity provides a framework purpose-built for AR development called AR Foundation. It allows you to build across multiple mobile and wearable AR devices, such as Android with ARCore and iOS with ARKit.

You can skip step 1 and 2 and start building now with our open-source Unity + AR Foundation + echoAR example project on GitHub.

1. Installing AR Foundation

To install AR Foundation through the Unity Package Manager, follow the instructions in the Unity documentation here.

2. Setup a simple AR application

Open the AR Foundation sample scene located in:

Assets > AR Foundation > Scenes > SimpleAR > SimpleAR

In the hierarchy click on the AR Session Origin game object.

In the inspector view, look for the Place on Plane script and set the Placed Prefab to the echoAR prefab in the Assets > echoAR folder.

3. Set you API key

Edit the echoAR prefab and set your API key through in the Inspector view.

4. Build and run the AR application

Go to File > Build Settings... or press Ctrl+Shift+B.

Make sure to set your platform to Android or iOS by choosing the target platform and press theSwitch Platform button on the bottom right corner.

Verify that the SimpleAR scene is ticked in the Scenes in Build list and click Build And Run.

5. Use you AR application

First, add a 3D model to the console.

When the application is loaded on your mobile device you might be asked to approve camera access permission.

Move the phone around until a surface is detected.

Tap the screen to place the model on the surface.

The model will steam and render in front of you.

If the model is too big or too small, got back to the console and add metadata to affect its scale. After adding metadata the model should change automatically.

You did it! 🎉