The Unity Profiler tool can be used to collect performance information about your app by building and running it on Meta VR. Unity Profiler can be useful for developers that want to profile performance directly from the Unity development environment.
This guide gives you the steps to connect your app to Unity Profiler and get started with collecting data. Unity has documented the Profiler in detail. We recommend reading their documentation if you have questions on any modules.
Setup
Only development builds can be used with Unity Profiler. To use Unity Profiler to analyze your project, follow these instructions:
Go to File > Build Profiles.
Make sure that Development Build is selected.
Make sure Autoconnect Profiler is selected. This option connects the development build via a local IP address to Unity Profiler so it can be analyzed when run on the device.
Press Build and Run to build and run on the Meta VR device. After the build successfully completes, the Profiler window will appear and populate with data.
Click Profiler Modules and select GPU Usage to add the GPU Usage Profiler to the list of modules if it is not present.
The project will build and run the app on the connected headset. Unity Profiler will begin collecting data from the running app. Once data has been collected, you can click on the timeline to select a frame that interests you and see an overview of the frame, including draw calls and timing, below.
Notes on Unity Profiler Results
There are several considerations to keep in mind when looking at Unity Profiler results.
Accuracy of Draw Call Timing
Note that due to profiling overhead, the absolute value of draw call timing is higher than the actual timing. This is especially true when there are many smaller draws. Due to this, we recommend using the number to do relative value comparisons instead of considering the absolute numbers.
Abnormalities from Runtime Preemptions
Sometimes there is some noise in the profiling results. For example, a very simple piece of geometry can sometimes show an abnormally high GPU timing. These abnormalities are typically caused by runtime GPU preemptions (such as boundary, Asynchronous TimeWarp). When developing for Meta VR, if such unusual results occur, we recommend that you collect several profiling samples and see if the abnormality recurs. Such collisions between a draw call and runtime preemptions can occur randomly.
Dynamic GPU Clock Levels
Meta VR devices dynamically adjust GPU clock speeds based on performance, power, and thermal conditions. Because GPU performance varies with the current clock level, compare profiling samples collected at the same GPU level. To learn how to monitor GPU levels, see CPU and GPU levels.