Rendering a cube in real world

Scripts under directory UnityARKit/NativeInterface, are the Unity’s scripting API implementations correspond to the ARKit native interface.

To reduce our work, the plugin’s authors also provide some boilerplate code under UnityARKit/Helpers and several useful materials.

Now, let’s continue with search some asset files and assign them to related components to achieve the goals listed below:

Blending 3D content to real-world

For the main camera, attach the Unity AR Video Script to it,

set its clear flag property to Depth Only and assign the YUVMaterial to Clear Material property.

Updating virtual camera’s position and orientation

Use the Unity AR Camera Manager Script and assign its Camera property to the main camera.

To achieve that, we can create an empty object(in this article, the name of that object is AppController, you can name it to whatever you want) and attach the script to it.

Now we can test whether the basic setup works.

Create a cube and drag it to make it a child of the main camera and make it always appear in front of the camera by setting the position.

Build the scene and run it in IOS device(uncheck the example one in build setting).

After running the application on your device, you will found the cube rendered in real-world.