Skip to content

Commit ceb02af

Browse files
committed
Update version defines to account for Unity 2019/2020/2021
1 parent 4805174 commit ceb02af

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

Assets/MRTK/Providers/WindowsMixedReality/XRSDK/MRTK.WMR.XRSDK.asmdef

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,18 @@
2929
},
3030
{
3131
"name": "com.unity.xr.windowsmr",
32-
"expression": "2.7",
33-
"define": "WMR_2_7_OR_NEWER_ENABLED"
32+
"expression": "[2.7,3.0)",
33+
"define": "WMR_2_7_0_OR_NEWER"
34+
},
35+
{
36+
"name": "com.unity.xr.windowsmr",
37+
"expression": "[4.4.2,5.0)",
38+
"define": "WMR_4_4_2_OR_NEWER"
39+
},
40+
{
41+
"name": "com.unity.xr.windowsmr",
42+
"expression": "5.2.2",
43+
"define": "WMR_5_2_2_OR_NEWER"
3444
},
3545
{
3646
"name": "com.microsoft.mixedreality.input",

Assets/MRTK/Providers/WindowsMixedReality/XRSDK/WindowsMixedRealityEyeGazeDataProvider.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
using Microsoft.MixedReality.Toolkit.Input;
55
using Microsoft.MixedReality.Toolkit.Utilities;
66
using System;
7-
using UnityEngine.XR;
87

9-
#if WMR_2_7_OR_NEWER_ENABLED
8+
// These versions represent the first version eye tracking became usable across Unity 2019/2020/2021
9+
// WMR_2_7_0_OR_NEWER stops being defined at 3.0 and WMR_4_4_2_OR_NEWER stops being defined at 5.0, exclusive
10+
#if WMR_2_7_0_OR_NEWER || WMR_4_4_2_OR_NEWER || WMR_5_2_2_OR_NEWER
1011
using Unity.Profiling;
1112
using Unity.XR.WindowsMR;
1213
using UnityEngine;
13-
#endif // WMR_2_7_OR_NEWER_ENABLED
14+
using UnityEngine.XR;
15+
#endif // WMR_2_7_0_OR_NEWER || WMR_4_4_2_OR_NEWER || WMR_5_2_2_OR_NEWER
1416

1517
namespace Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality
1618
{
@@ -69,18 +71,18 @@ public WindowsMixedRealityEyeGazeDataProvider(
6971

7072
/// <inheritdoc />
7173
public bool CheckCapability(MixedRealityCapability capability) =>
72-
#if WMR_2_7_OR_NEWER_ENABLED
74+
#if WMR_2_7_0_OR_NEWER || WMR_4_4_2_OR_NEWER || WMR_5_2_2_OR_NEWER
7375
capability == MixedRealityCapability.EyeTracking
7476
&& centerEye.isValid
7577
&& centerEye.TryGetFeatureValue(WindowsMRUsages.EyeGazeAvailable, out bool gazeAvailable)
7678
&& gazeAvailable;
7779
#else
7880
false;
79-
#endif // WMR_2_7_OR_NEWER_ENABLED
81+
#endif // WMR_2_7_0_OR_NEWER || WMR_4_4_2_OR_NEWER || WMR_5_2_2_OR_NEWER
8082

8183
#endregion IMixedRealityCapabilityCheck Implementation
8284

83-
#if WMR_2_7_OR_NEWER_ENABLED
85+
#if WMR_2_7_0_OR_NEWER || WMR_4_4_2_OR_NEWER || WMR_5_2_2_OR_NEWER
8486
private InputDevice centerEye = default(InputDevice);
8587

8688
/// <inheritdoc />
@@ -161,6 +163,6 @@ public override void Update()
161163
}
162164
}
163165
}
164-
#endif // WMR_2_7_OR_NEWER_ENABLED
166+
#endif // WMR_2_7_0_OR_NEWER || WMR_4_4_2_OR_NEWER || WMR_5_2_2_OR_NEWER
165167
}
166168
}

0 commit comments

Comments
 (0)