Skip to main content

2 replies

Participant
November 16, 2025

Hi iByte​ ! Within the "BaseNetworkPlayer.cs" script, there's a "OnNetworkSpawn()" function where the head & hand origins are initialized via linking with OVRCameraRig's center eye & controller anchors - which their positions & rotations will sync across multiplayer.

Hope this clarifies! :)

public override void OnNetworkSpawn()
        {
            base.OnNetworkSpawn();
            if (IsOwner)
            {
                // Set Local Player.
                LocalPlayer = this;
                XRINetworkGameManager.Instance.LocalPlayerConnected(NetworkObject.OwnerClientId);

                // Get Origin and set head.
                OVRCameraRig rig = FindFirstObjectByType<OVRCameraRig>();
                if (rig != null)
                {
                    m_HeadOrigin = rig.centerEyeAnchor;
                    SetHandOrigins(rig.leftControllerAnchor, rig.rightControllerAnchor);
                }
                else
                {
                    Utils.Log("No XR Rig Available", 1);
                }

                SetupLocalPlayer();
            }
            CompleteSetup();
        }

 

iByteAuthor
Inspiring
November 16, 2025

Thank you for the reply. I’m working through this because I’m trying to do the same thing with Unity’s tabletop multiplayer mixed reality template the same way Valem did using the VR multiplayer template. I’ve got the player joining using the prefab from the golf game, but I’m still having some issues trying to get the UI to respond to Ray or poke interactions.