I am running the latest XR packages installed as described in the replication instructions below. My scene has hardly anything in it, and yet I am having regular frame stuttering/drops (5-10 times per second).
When you run the build I describe below on the Quest 2 (while connected to the build computer), you should see profiling data rolling in, in particular the frame rate chart.
When pointing the headset almost anywhere, the CPU usage is around 14 ms (72fps). *** Except *** When looking down at the 5+ planes and the XR interaction rays, the CPU usage doubles to around 28 ms (36fps) every 8 frames (although it will happen more frequently if there is more geometry in the scene).
In this scene, render profiling shows only 12 batches and 3,730 triangles per frame, which is much less than the recommendations of 50-100 batches and 50,000-100,000 triangles per frame that Oculus suggests for 72 fps. These batch and triangle values in the profiler do not vary across frames even when the frame drops are occurring.
What can I do about this?
Additional observations:
The frame drops occur in simple scenes when post-processing effects are used (try putting an XR Rig into the default URP scene).
The frame drops occur in this scene when the oculus is set to target 120 fps. In that case, the frame drops occur more often, resulting in an actually worse average fps than when the target is 72 fps.
The frame drops occur in scenes even when development build is turned off.
The frame drops occur in even when the XR Ray Interactors are not present, you just need to add a few more planes.
Multi-pass vs. multi-view rendering has no effect on the frame drops.
Since the rest of the calls each frame are completed within 2-3 ms, it doesn’t look like it should be running out of CPU time, and if it was the geometry in the scene, it seems like it would lag on every frame, not every 8 frames.
The main issue seems to come from the render thread, which shows a PlayerEndOfFrame call causing all of the extra lag. Turning off multithreaded rendering shows an additional call under PlayerEndOfFrame called FrameEvents.XREndFrame .
==== Minimal instructions to replicate problem ====
New Unity project (2021.1.15f1.2775)
3D template
Enable pre-release packages
Install XR Interaction Toolkit
Install XR Plugin Management
Go to Project Settings → XR Plug-in Management
Enable (under android) Oculus
Remove default camera from scene
Add XR → XR Rig (Action-based) to scene
Set XR Rig tracking origin mode to floor (suggested, but frame drops still happen if you don’t do this step)
Add 5+ planes to the scene (add more for exaggerated effect!)
Go to Build Settings
Switch target to Android
Set Development Build
Set Autoconnect Profiler
Add the open scene
Select the Quest 2 run device
Click Build And Run
Wait for the build to run on the Quest 2
Point Quest 2 towards the sky, and observe steady frame rate in profiler
Point Quest 2 towards the planes (& xr interaction rays, if you only added a few planes), and observe regular frame drops in profiler
==== End instructions ====