
I hope this article will be useful to those who want to feel the possibilities of ARCore augmented reality in Unity, but at the same time could not find understandable instructions.
We’ll compile an example of
Augmented Faces ARCore Augmented Faces app for Unity, it will track a face through the camera and overlay a 3D model with a fox snout.
Why in Unity?
')
- Just for fun.
- In the examples for Android studio out of the box there is no possibility to work in the rear camera, only with the front camera.
- I had to deal with Unity as part of the work.
To accomplish our task, we will need
Unity itself, the
ARCore for Unity SDK , an Android-
compatible device, the
Android SDK . You can do without the device, but in this article this option is not reflected.
Unity
We create the new project in Unity. Specify 3D type After creating the project, we import the
Augmented Faces ARCore package that was previously downloaded, which is called
arcore-unity-sdk-1.7.0.unitypackage .
Unity will ask for exactly what to import.
After successful import in the Project window we find and open the scene with an example.
Assets \ GoogleARCore \ Examples \ AugmentedFaces \ Scenes Specify the location of the Android SDK.
Edit / Preferences / External tools Switch the platform to Android, and click “Switch Platform”.
In the previous window, click the button “Player settings ..” to configure the publication.
Change the name of the Android application.
We are convinced whether support ARCore.
We return to the window “Build Settings” and indicate our device. On the device should be enabled debugging via USB, and installation via USB.
This should be enough to build and run the application on our device. In the same window, click "Build And Run", as a result we get something like that.