Obviously, the most important part of any project is actually to implement what we want to accomplish. We want this project to play a literary quote from a list of audio samples automatically. To do this, we need an audio source and audio clips. We also want this project to take advantage of ARKit to run, so we need to write a C# class that utilizes features from the ARKit plugin that is exposed from the Objective-C and C++ libraries.
Let’s open up the
ARHitCube class, fill in the details, and explain what is happening at the same time. I should note that very similar code is already provided in the script file called
UnityARHitTestExample; I created this script to be able to show only what is needed and to be able to explain the workflow/thoughts necessary for creating the functionality we need:
using System; using System.Collections.Generic;
- As per usual, we will only call the specific namespaces we need for our project. In this case, it is