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)
52
52
53
53
Camera FindCamera ( )
54
54
{
55
+ #if UNITY_2023_1_OR_NEWER
56
+ Camera [ ] cameras = FindObjectsByType < Camera > ( FindObjectsSortMode . None ) ;
57
+ #else
55
58
Camera [ ] cameras = FindObjectsOfType < Camera > ( ) ;
59
+ #endif
56
60
Camera result = null ;
57
61
int camerasSum = 0 ;
58
62
foreach ( var camera in cameras )
Original file line number Diff line number Diff line change @@ -41,7 +41,11 @@ void Start()
41
41
}
42
42
if ( leftController == null || rightController == null )
43
43
{
44
+ #if UNITY_2023_1_OR_NEWER
45
+ var controllers = FindObjectsByType < WebXRController > ( FindObjectsSortMode . None ) ;
46
+ #else
44
47
var controllers = FindObjectsOfType < WebXRController > ( ) ;
48
+ #endif
45
49
for ( int i = 0 ; i < controllers . Length ; i ++ )
46
50
{
47
51
if ( controllers [ i ] . hand == WebXRControllerHand . LEFT )
@@ -67,7 +71,11 @@ void OnEnable()
67
71
originPosition = originTransform . localPosition ;
68
72
originRotation = originTransform . localRotation ;
69
73
WebXRManager . OnXRChange += HandleOnXRChange ;
74
+ #if UNITY_2023_1_OR_NEWER
75
+ arCameraTransform = FindFirstObjectByType < WebXRCamera > ( ) ? . GetCamera ( WebXRCamera . CameraID . LeftAR ) . transform ;
76
+ #else
70
77
arCameraTransform = FindObjectOfType < WebXRCamera > ( ) ? . GetCamera ( WebXRCamera . CameraID . LeftAR ) . transform ;
78
+ #endif
71
79
if ( arCameraTransform == null )
72
80
{
73
81
arCameraTransform = Camera . main . transform ;
You can’t perform that action at this time.
0 commit comments