public virtual void EnsureGameObjectIntegrity() { if (LeftEyeAnchor == null) { LeftEyeAnchor = ConfigureAnchor(LeftEyeAnchorName); } if (RightEyeAnchor == null) { RightEyeAnchor = ConfigureAnchor(RightEyeAnchorName); } if (LeftEyeCamera == null || RightEyeCamera == null) { LeftEyeCamera = LeftEyeAnchor.GetComponent <Camera>(); RightEyeCamera = RightEyeAnchor.GetComponent <Camera>(); if (LeftEyeCamera == null) { LeftEyeCamera = LeftEyeAnchor.gameObject.AddComponent <Camera>(); LeftEyeCamera.tag = "MainCamera"; LeftEyeCamera.depth = 1; } if (RightEyeCamera == null) { RightEyeCamera = RightEyeAnchor.gameObject.AddComponent <Camera>(); RightEyeCamera.tag = "MainCamera"; RightEyeCamera.depth = 1; } LeftEyeCamera.stereoTargetEye = StereoTargetEyeMask.Left; RightEyeCamera.stereoTargetEye = StereoTargetEyeMask.Right; } }
private void SetupHierarchy() { if (TrackingSpace == null) { TrackingSpace = ConfigureRootAnchor(trackingSpaceName); } if (LeftEyeAnchor == null) { LeftEyeAnchor = ConfigureEyeAnchor(TrackingSpace, VREyeType.LeftEye); } if (CenterEyeAnchor == null) { CenterEyeAnchor = ConfigureEyeAnchor(TrackingSpace, VREyeType.CenterEye); } if (RightEyeAnchor == null) { RightEyeAnchor = ConfigureEyeAnchor(TrackingSpace, VREyeType.RightEye); } if (TrackerAnchor == null) { TrackerAnchor = ConfigureTrackerAnchor(TrackingSpace); } if (LeftControllerAnchor == null) { LeftControllerAnchor = ConfigureControllerAnchor(TrackingSpace, VRControllerRole.LeftHand); LeftController = LeftControllerAnchor.GetScript <VRController>(); } if (RightControllerAnchor == null) { RightControllerAnchor = ConfigureControllerAnchor(TrackingSpace, VRControllerRole.RightHand); RightController = RightControllerAnchor.GetScript <VRController>(); } if (LeftEyeCamera == null || RightEyeCamera == null || AttachedCamera == null) { LeftEyeCamera = LeftEyeAnchor.GetChild <Camera>(); if (LeftEyeCamera == null) { LeftEyeCamera = Camera.New(); LeftEyeAnchor.AddChild(LeftEyeCamera); } RightEyeCamera = RightEyeAnchor.GetChild <Camera>(); if (RightEyeCamera == null) { RightEyeCamera = Camera.New(); RightEyeAnchor.AddChild(RightEyeCamera); } AttachedCamera = CenterEyeAnchor.GetChild <Camera>(); if (AttachedCamera == null) { AttachedCamera = Camera.New(); CenterEyeAnchor.AddChild(AttachedCamera); } } vrControllers = Actor.GetScriptsRecursive <VRController>(); RefreshVRMode(); RefreshCameraProperties(); isInitialized = true; }