Google is committed to advancing racial equity for Black communities. See how.

Depth API for quickstart Unity

This guide shows you how to try out occlusion and visualize the depth map in a sample app.


  • An Android device that supports Depth. See the list of Depth API supported devices for details.
  • A basic understanding of Android development. If you are new to Android, see Build your first app.
  • A basic understanding of the Depth API. If you are new to working with Depth, see the Depth API Overview for an introduction.
  • The ARCore SDK for Unity, configured to target Android. See the Unity quickstart for Android for installation and instructions for configuring your environment.

ARCore Depth Lab

The ARCore Depth Lab app (source code) showcases a variety of depth-sensing AR experiences that you can use as a starting point for your app.

Run the sample app

The HelloAR app (version 1.18 and later) lets you place and manipulate Android figurines on detected AR plane surfaces. It is implemented with Android GL SurfaceView, which is used to render the camera preview and basic AR objects such as Planes and Anchors.

Follow the instructions in the Unity quickstart for Android to run the HelloAR sample app on your supported device.

Enable Depth

The first time you run the app and place an Android figure, a dialog will prompt you to enable Depth. It only appears the first time the app is run, for the first Android placed. Tap Enable to add occlusion.

Toggle occlusion and a visualization of the depth map

Tap the gear icon to toggle occlusion and a visualization of the depth map. Select Enable depth to enable occlusion. Select Show depth map to display a visualization of the depth map on the device's screen.

The following images show a virtual pawn in a real space. In the first image, the virtual pawn unrealistically overlaps with the edge of the chair. In the second image, the pawn is properly occluded, appearing much more realistic in its surroundings.

The images below show a camera image of a chair in a room, and a visualization of the depth map that is created for that camera image.

Next steps

Start using the Depth API in your own apps. To learn more, see: