Oculus SDK performance issues when project is launched from Unity Hub
We recently upgraded our Oculus Unity Integration from v1.36 to v16 and noticed the behavior I'm about to describe. I'm also able to reproduce it in a new project with just the Oculus Unity Integration package and the sample scenes included with it. It's...weird.
I'm using Unity 2018.4.4f1, building for standalone (but have also tried with Android), using a Rift CV1. I have a Quest + Link attached to my PC as well, but it's not my active device (and is currently unplugged). Testing with the Assets/Oculus/Avatar/Samples/Controllers scene and the Assets/Oculus/Avatar/Samples/LocalAvatar scene.
When I launch the Unity Editor directly, every frame takes about 3ms. When I launch my project via Unity Hub (v2.3.1), every frame takes about 9ms, with the extra time going to:
^ (logged one time)
^ (spammed in the log over and over)
At this point, I should clarify: it's not a given that launching from the Unity Hub will trigger the degradation in performance, it just has a very good chance of making it happen. I've launched Unity over and over, both from the hub and without it, and launching from the hub almost always triggers this degradation, but occasionally it doesn't. Similarly, I've seen this happen when launching the editor directly, but it's very rare. All of this leads me to believe that there's some sort of race condition during plugin initialization that might be exacerbated by the extra time Unity takes to set up IPC between editor <-> hub (which it doesn't do when the editor is launched directly).
I haven't had time to test this in every version of the Oculus Unity Integration SDK, but I've found that it happens in v16, v15, and v14, and I haven't managed to reproduce it in v1.36 or v12.
Whatever is happening here could also be the underlying cause of these issues:
https://forums.oculusvr.com/developer/discussion/89263/massive-cpu-usage-by-ovrmanager-update-talking-to-ovrplugin-in-v16
https://forums.oculusvr.com/developer/discussion/89040/ovrinput-updates-killing-performance
I'm using Unity 2018.4.4f1, building for standalone (but have also tried with Android), using a Rift CV1. I have a Quest + Link attached to my PC as well, but it's not my active device (and is currently unplugged). Testing with the Assets/Oculus/Avatar/Samples/Controllers scene and the Assets/Oculus/Avatar/Samples/LocalAvatar scene.
When I launch the Unity Editor directly, every frame takes about 3ms. When I launch my project via Unity Hub (v2.3.1), every frame takes about 9ms, with the extra time going to:
- XR.DeviceSDK (2.66ms)
- OVRP_1_16_0.ovrp_GetControllerState4() (2.63ms)
- OVRPlugin.UpdateNodePhysicsPoses() (1.18ms)
[OVRPlugin][ERROR] Device required[OVRPlugin][ERROR] ovr_GetCurrentHandInputState failed: ovr_GetCurrentHandInputState: Only Oculus Link is supported.At this point, I should clarify: it's not a given that launching from the Unity Hub will trigger the degradation in performance, it just has a very good chance of making it happen. I've launched Unity over and over, both from the hub and without it, and launching from the hub almost always triggers this degradation, but occasionally it doesn't. Similarly, I've seen this happen when launching the editor directly, but it's very rare. All of this leads me to believe that there's some sort of race condition during plugin initialization that might be exacerbated by the extra time Unity takes to set up IPC between editor <-> hub (which it doesn't do when the editor is launched directly).
I haven't had time to test this in every version of the Oculus Unity Integration SDK, but I've found that it happens in v16, v15, and v14, and I haven't managed to reproduce it in v1.36 or v12.
Whatever is happening here could also be the underlying cause of these issues:
https://forums.oculusvr.com/developer/discussion/89263/massive-cpu-usage-by-ovrmanager-update-talking-to-ovrplugin-in-v16
https://forums.oculusvr.com/developer/discussion/89040/ovrinput-updates-killing-performance
