Open the sample project (if you haven’t already) and open the SampleScene as per the previous section.
We’re going to build the sample for Android. To do so takes just a few steps and they are all achieved from the Build Settings window.
First off, we need to switch the project to Android.
Select File->Build Settings to show the Build Settings window:
Notice how the project is currently in “Windows, Mac, Linux” mode. We need to switch to Android.
Select Android on the left and then click on Switch Platform. This will take a few moments as it re-builds the assets for the Android mode (this step can take longer the first time it is done for any project).
We must now tell Unity which scene to open when the app runs. This affects all platforms. Click on Add Open Scenes to add the opened sample scene to the Scenes in Build list. We will only need to do this once.
That’s all we need to do to simply run the app. There are a couple more steps required to run the profiler but we’ll cover those later.
To deploy to your Android device, we will need to enable the Android Developer Options and USB Debugging on your device:
Go to your Android settings app
Scroll to the bottom to find Developer Options. If you do not see this option, follow the instructions for configuring developer options .
In Developer Options ensure the On option is enabled.
Scroll down to find and enable USB Debugging.
Connect your Android device to your computer using a USB cable. Unity may take a few moments to recognize it.
Android may ask for confirmation before enabling the connection.
In the Build Settings window:
Ensure your device appears in the Run Device menu and select it.
Select Build and Run. Choose a location to save your build.
The project will now build for Android and deploy to your device.
You will see the spinning cube running slowly. On recent Android devices, we would definitely expect it to run more quickly (at 60 frames per second).
We’re now ready to dive into the Unity Profiler.