2
2
using System . Runtime . InteropServices ;
3
3
using AOT ;
4
4
using UnityEngine ;
5
-
6
5
#if UNITY_XR_MANAGEMENT_4_3_1_OR_NEWER
7
6
using UnityEngine . SubsystemsImplementation ;
8
7
#endif
@@ -72,20 +71,6 @@ protected override void OnStart()
72
71
Instance = this ;
73
72
InternalStart ( ) ;
74
73
}
75
-
76
- protected override void OnStop ( )
77
- {
78
- if ( Instance == null ) return ;
79
- Debug . Log ( "Stop " + nameof ( WebXRSubsystem ) ) ;
80
- Instance = null ;
81
- }
82
-
83
- protected override void OnDestroy ( )
84
- {
85
- if ( Instance == null ) return ;
86
- Debug . Log ( "Destroy " + nameof ( WebXRSubsystem ) ) ;
87
- Instance = null ;
88
- }
89
74
#else
90
75
public override void Start ( )
91
76
{
@@ -95,26 +80,42 @@ public override void Start()
95
80
Instance = this ;
96
81
InternalStart ( ) ;
97
82
}
83
+ #endif
98
84
85
+ #if UNITY_XR_MANAGEMENT_4_3_1_OR_NEWER
86
+ protected override void OnStop ( )
87
+ {
88
+ if ( Instance == null ) return ;
89
+ Debug . Log ( "Stop " + nameof ( WebXRSubsystem ) ) ;
90
+ Instance = null ;
91
+ }
92
+ #else
99
93
public override void Stop ( )
100
94
{
101
95
if ( ! _running ) return ;
102
96
Debug . Log ( "Stop " + nameof ( WebXRSubsystem ) ) ;
103
97
_running = false ;
104
98
Instance = null ;
105
99
}
100
+ #endif
106
101
102
+ #if UNITY_XR_MANAGEMENT_4_3_1_OR_NEWER
103
+ protected override void OnDestroy ( )
104
+ {
105
+ if ( Instance == null ) return ;
106
+ Debug . Log ( "Destroy " + nameof ( WebXRSubsystem ) ) ;
107
+ Instance = null ;
108
+ }
109
+ #else
107
110
protected override void OnDestroy ( )
108
111
{
109
112
if ( ! running ) return ;
110
113
Debug . Log ( "Destroy " + nameof ( WebXRSubsystem ) ) ;
111
114
_running = false ;
112
115
Instance = null ;
113
116
}
114
-
115
- private bool _running ;
116
- public override bool running => _running ;
117
117
#endif
118
+
118
119
private void UpdateControllersOnEnd ( )
119
120
{
120
121
if ( OnHandUpdate != null )
@@ -225,12 +226,14 @@ private void UpdateXRCameras()
225
226
}
226
227
}
227
228
228
- //private bool _running;
229
- //public override bool running => _running;
229
+ #if ! UNITY_XR_MANAGEMENT_4_3_1_OR_NEWER
230
+ private bool _running ;
231
+ public override bool running => _running ;
232
+ #endif
230
233
231
234
private static WebXRSubsystem Instance ;
232
235
233
- internal void InternalStart ( )
236
+ private void InternalStart ( )
234
237
{
235
238
#if UNITY_WEBGL
236
239
Native . SetWebXREvents ( OnStartAR , OnStartVR , UpdateVisibilityState , OnEndXR , OnXRCapabilities , OnInputProfiles ) ;
0 commit comments