Skip to content

Commit d06f1c3

Browse files
committed
Protect compilation on other platforms
1 parent d01c85e commit d06f1c3

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

MainProject/ProjectSettings/ProjectSettings.asset

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ PlayerSettings:
125125
16:9: 1
126126
Others: 1
127127
bundleVersion: 0.1
128-
preloadedAssets: []
128+
preloadedAssets:
129+
- {fileID: -7174462851341203133, guid: 552445d583cb06c4eaf9d56596dd45c2, type: 2}
130+
- {fileID: 11400000, guid: 65eada5edf5f16b4a9d0bd3a76fa026f, type: 2}
131+
- {fileID: 11400000, guid: a5e5b7605fb48984988490688c2a74e2, type: 2}
129132
metroInputSource: 0
130133
wsaTransparentSwapchain: 0
131134
m_HolographicPauseOnTrackingLoss: 1

MainProject/ProjectSettings/XRSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
],
66
"m_SettingValues": [
77
"True",
8-
"False"
8+
"True"
99
]
1010
}

Packages/webxr/Runtime/Scripts/WebXRController.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using UnityEngine;
2-
#if UNITY_EDITOR
2+
#if UNITY_EDITOR || !UNITY_WEBGL
33
using UnityEngine.XR;
44
#endif
55
using System;
@@ -67,7 +67,7 @@ public enum Axis2DTypes
6767

6868
private string[] profiles = null;
6969

70-
#if UNITY_EDITOR
70+
#if UNITY_EDITOR || !UNITY_WEBGL
7171
private InputDeviceCharacteristics xrHand = InputDeviceCharacteristics.Controller;
7272
private InputDevice? inputDevice;
7373
private HapticCapabilities? hapticCapabilities;
@@ -81,7 +81,7 @@ private void Update()
8181

8282
private void TryUpdateButtons()
8383
{
84-
#if UNITY_EDITOR
84+
#if UNITY_EDITOR || !UNITY_WEBGL
8585
if (buttonsFrameUpdate == Time.frameCount)
8686
{
8787
return;
@@ -375,7 +375,7 @@ public void Pulse(float intensity, float durationMilliseconds)
375375
{
376376
WebXRManager.Instance.HapticPulse(hand, intensity, durationMilliseconds);
377377
}
378-
#if UNITY_EDITOR
378+
#if UNITY_EDITOR || !UNITY_WEBGL
379379
else if (inputDevice != null && hapticCapabilities != null
380380
&& hapticCapabilities.Value.supportsImpulse)
381381
{
@@ -392,7 +392,7 @@ void OnEnable()
392392
WebXRManager.OnHeadsetUpdate += OnHeadsetUpdate;
393393
SetControllerActive(false);
394394
SetHandActive(false);
395-
#if UNITY_EDITOR
395+
#if UNITY_EDITOR || !UNITY_WEBGL
396396
switch (hand)
397397
{
398398
case WebXRControllerHand.LEFT:
@@ -422,14 +422,14 @@ void OnDisabled()
422422
WebXRManager.OnHeadsetUpdate -= OnHeadsetUpdate;
423423
SetControllerActive(false);
424424
SetHandActive(false);
425-
#if UNITY_EDITOR
425+
#if UNITY_EDITOR || !UNITY_WEBGL
426426
InputDevices.deviceConnected -= HandleInputDevicesConnected;
427427
InputDevices.deviceDisconnected -= HandleInputDevicesDisconnected;
428428
inputDevice = null;
429429
#endif
430430
}
431431

432-
#if UNITY_EDITOR
432+
#if UNITY_EDITOR || !UNITY_WEBGL
433433
private void HandleInputDevicesConnected(InputDevice device)
434434
{
435435
if (device.characteristics.HasFlag(xrHand))

Packages/webxr/Runtime/WebXR.asmdef

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
"Unity.XR.Management",
55
"Unity.Subsystem.Registration"
66
],
7-
"includePlatforms": [
8-
"Editor",
9-
"WebGL"
10-
],
7+
"includePlatforms": [],
118
"excludePlatforms": [],
129
"allowUnsafeCode": false,
1310
"overrideReferences": true,

0 commit comments

Comments
 (0)