Setting up your Android device with Unity AR

Unity AR enables developers to create interactive and immersive experiences by overlaying virtual objects in the real world. Unity AR allows you to create AR experiences using a combination of computer vision, sensor data (camera, etc.), and AR-specific libraries and plugins.

Connecting Android devices with Unity

You can use your mobile to test the AR applications you are building for Android. Properly connecting your device with Unity is essential, as you might get a black screen on your phone after running the apk file on your device.

  1. When you've created your project, go to file, then build settings. Select Android and click on "Switch Platform." Check the "Development Build" box. Next up, click on "Player Settings" in the bottom left corner.

Switching platform to Android
Switching platform to Android
  1. When the player settings window opens, select Android and check the box for "Google AR Core." In the graphics API, select "OpenGLES2" and click on the minus sign (-) to remove it.

Updating player settings
Updating player settings
  1. Next, ensure the minimum API level is 24 and the scripting background is "IL2CPP."

Updating player settings
Updating player settings
  1. Change settings in your phone to turn on development mode. Go to "Settings" > "Developer options" and turn it on.

Turning on developer options on Android
Turning on developer options on Android
  1. Now connect your device to your system through a cable and click on "Build and Run." Save your apk file on the system, and your application will open on your phone.

Once downloaded, you can open the application on your mobile phone without connecting to your system. However, if you want to make changes, you'll have to build and rerun it to download the updated apk file on your device.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved