cancel
Showing results for 
Search instead for 
Did you mean: 

[Photon PUN 2] Camera “freezes” in the Oculus Quest when second player joins room

echin
Level 2

I'm building a Unity VR multiplayer application, following this course on Udemy. In the course, they use the Unity XR Interaction toolkit, but I've been using the Oculus Integration package instead. So far, this hasn't created any significant problems - until I begin testing with two players.

I've been running into a problem where the moment a second player enters a room, the camera inside the VR headset goes wonky. It becomes frozen or fixed at a certain position, as if the world is stuck to the camera. I know that the scene still runs because I tried it with my headset pointing at a campfire with particle effects, which were still moving and running fine. I found a link here that describes pretty much exactly the problem I'm running into, except their solution didn't work for me. I also don't have control over my hands / avatar - it's like I'm being placed in the headset but I'm not actually there. I'm quite baffled, and I'm not sure what to do anymore.

I created a bare minimum application here with two scenes that duplicates the issue. One weird thing is when I open the application in my Quest, and then open it in my editor, and then close and reopen the application in the editor one more time, the camera in my Quest goes back to normal, but I still can't do anything with my controllers.

Before anyone mentions it, I've set in script to have a player's OVRCameraRig become disabled if IsMine is false (ie, so camera rigs aren't kept on for remote players). So at all times, there will only be one camera rig in the scene for the local player.

1 REPLY 1

julienkay
Level 5

This does sound like a problem of multiple cameras being active in the scene at the same time.

 


@echin wrote:

Before anyone mentions it, I've set in script to have a player's OVRCameraRig become disabled if IsMine is false (ie, so camera rigs aren't kept on for remote players). So at all times, there will only be one camera rig in the scene for the local player.


The problem with this is that simply disabling the OVRCameraRig GameObject won't be enough. For one, if you look into OVRCameraRig.cs it subscribes to Application.onBeforeRender which is invoked even if the Script/GameObject is disabled and in turn can re-enable the cameras of a remote OVRCameraRig. Another thing is, that scripts like OVRManager are essentially singletons that are accessed through a static accessor OVRManager.instance. If you have multiple singletons in a scene you're bound to run into problems (no matter if the script is disabled or not).

 

Generally I would strongly advice against spawning a full OVRCameraRig for every joining player. Those prefabs are really only meant to be run locally.