@@ -158,13 +158,16 @@ private void UpdateXRCameras()
158
158
159
159
private void InternalStart ( )
160
160
{
161
+ #if UNITY_WEBGL
161
162
Native . set_webxr_events ( OnStartAR , OnStartVR , OnEndXR , OnXRCapabilities , OnInputProfiles ) ;
162
163
Native . InitControllersArray ( controllersArray , controllersArray . Length ) ;
163
164
Native . InitHandsArray ( handsArray , handsArray . Length ) ;
164
165
Native . InitViewerHitTestPoseArray ( viewerHitTestPoseArray , viewerHitTestPoseArray . Length ) ;
165
166
Native . InitXRSharedArray ( sharedArray , sharedArray . Length ) ;
167
+ #endif
166
168
}
167
169
170
+ #if UNITY_WEBGL
168
171
private static class Native
169
172
{
170
173
[ DllImport ( "__Internal" ) ]
@@ -198,6 +201,7 @@ public static extern void set_webxr_events(Action<int, float, float, float, floa
198
201
Action < string > on_xr_capabilities ,
199
202
Action < string > on_input_profiles ) ;
200
203
}
204
+ #endif
201
205
202
206
internal WebXRState xrState = WebXRState . NORMAL ;
203
207
@@ -332,41 +336,51 @@ public static void OnEndXR()
332
336
333
337
public void ToggleAR ( )
334
338
{
339
+ #if UNITY_WEBGL
335
340
if ( capabilities . canPresentAR )
336
341
{
337
342
Native . ToggleAR ( ) ;
338
343
}
344
+ #endif
339
345
}
340
346
341
347
public void ToggleVR ( )
342
348
{
349
+ #if UNITY_WEBGL
343
350
if ( capabilities . canPresentVR )
344
351
{
345
352
Native . ToggleVR ( ) ;
346
353
}
354
+ #endif
347
355
}
348
356
349
357
public void StartViewerHitTest ( )
350
358
{
359
+ #if UNITY_WEBGL
351
360
if ( xrState == WebXRState . AR && ! viewerHitTestOn )
352
361
{
353
362
viewerHitTestOn = true ;
354
363
Native . ToggleViewerHitTest ( ) ;
355
364
}
365
+ #endif
356
366
}
357
367
358
368
public void StopViewerHitTest ( )
359
369
{
370
+ #if UNITY_WEBGL
360
371
if ( xrState == WebXRState . AR && viewerHitTestOn )
361
372
{
362
373
viewerHitTestOn = false ;
363
374
Native . ToggleViewerHitTest ( ) ;
364
375
}
376
+ #endif
365
377
}
366
378
367
379
public void HapticPulse ( WebXRControllerHand hand , float intensity , float duration )
368
380
{
381
+ #if UNITY_WEBGL
369
382
Native . ControllerPulse ( ( int ) hand , intensity , duration ) ;
383
+ #endif
370
384
}
371
385
372
386
void GetMatrixFromSharedArray ( int index , ref Matrix4x4 matrix )
0 commit comments