File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Packages/webxr-interactions/Runtime/Scripts Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,11 @@ Vector3 GetMousePosWithScreenZ(float screenZ)
5252
5353 Camera FindCamera ( )
5454 {
55+ #if UNITY_2023_1_OR_NEWER
56+ Camera [ ] cameras = FindObjectsByType < Camera > ( FindObjectsSortMode . None ) ;
57+ #else
5558 Camera [ ] cameras = FindObjectsOfType < Camera > ( ) ;
59+ #endif
5660 Camera result = null ;
5761 int camerasSum = 0 ;
5862 foreach ( var camera in cameras )
Original file line number Diff line number Diff line change @@ -41,7 +41,11 @@ void Start()
4141 }
4242 if ( leftController == null || rightController == null )
4343 {
44+ #if UNITY_2023_1_OR_NEWER
45+ var controllers = FindObjectsByType < WebXRController > ( FindObjectsSortMode . None ) ;
46+ #else
4447 var controllers = FindObjectsOfType < WebXRController > ( ) ;
48+ #endif
4549 for ( int i = 0 ; i < controllers . Length ; i ++ )
4650 {
4751 if ( controllers [ i ] . hand == WebXRControllerHand . LEFT )
@@ -67,7 +71,11 @@ void OnEnable()
6771 originPosition = originTransform . localPosition ;
6872 originRotation = originTransform . localRotation ;
6973 WebXRManager . OnXRChange += HandleOnXRChange ;
74+ #if UNITY_2023_1_OR_NEWER
75+ arCameraTransform = FindFirstObjectByType < WebXRCamera > ( ) ? . GetCamera ( WebXRCamera . CameraID . LeftAR ) . transform ;
76+ #else
7077 arCameraTransform = FindObjectOfType < WebXRCamera > ( ) ? . GetCamera ( WebXRCamera . CameraID . LeftAR ) . transform ;
78+ #endif
7179 if ( arCameraTransform == null )
7280 {
7381 arCameraTransform = Camera . main . transform ;
You can’t perform that action at this time.
0 commit comments