Changing script from XRRig to XROrigin?

Hi!
I just updated the XR Interaction Toolkit in one of my work projects and noticed one of my scripts went bananas.
As I am doing a multiplayer application with Photon I have a network script where I earlier did this:
XRRig rig = FindObjectOfType();
headRig = rig.transform.Find(“Camera Offset/Main Camera”);
leftHandRig = rig.transform.Find(“Camera Offset/LeftHand Controller”);
rightHandRig = rig.transform.Find(“Camera Offset/RightHand Controller”);

My question is how do I make this work with the XROrigin object instead? It says XROrigin is defined in an assembly that is not referenced?

Hope someone can help as I haven’t been able to find documentation that makes this clear to me.

Thanks!

1 Like

You need to add the using directive

using Unity.XR.CoreUtils;

You still get an error or autocomplete won’t add it, rebuild your project files under Preferences - > External Tools > Regenerate Project Files.

5 Likes

Thanks dpcactus, I tried it earlier and it wouldn’t seem to work but I probably needed to rebuild as you mention. When I tried just now it worked just fine :slight_smile:

1 Like

works for me, ty

Did work for me :((

Rebuild your project files works in my project

im new and donnt know how

(On Windows) Go to Edit → Preferences → External Tools, and click “Regenerate Project Files”. If this still doesn’t work, you could try closing your project, deleting the library folder, and re-opening the project (Unity will auto generate a new library folder for you).