Skip to content

Commit ab21df0

Browse files
committed
Slightly simplify #ifs
1 parent 5b18da3 commit ab21df0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Assets/MRTK/Core/Utilities/Editor/XRSettingsUtilities.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public static bool XRSDKEnabled
3434
{
3535
get
3636
{
37-
#if UNITY_2019_3_OR_NEWER && XR_MANAGEMENT_ENABLED
37+
#if XR_MANAGEMENT_ENABLED
3838
return XRSDKLoadersOfCurrentBuildTarget.Count > 0;
3939
#else
4040
return false;
41-
#endif // UNITY_2019_3_OR_NEWER && XR_MANAGEMENT_ENABLED
41+
#endif // XR_MANAGEMENT_ENABLED
4242
}
4343
}
4444

@@ -49,11 +49,11 @@ public static bool MicrosoftOpenXRPresent
4949
{
5050
get
5151
{
52-
#if UNITY_2020_2_OR_NEWER && MSFT_OPENXR
52+
#if MSFT_OPENXR
5353
return true;
5454
#else
5555
return false;
56-
#endif // UNITY_2019_3_OR_NEWER
56+
#endif // MSFT_OPENXR
5757
}
5858
}
5959

@@ -65,7 +65,7 @@ public static bool MicrosoftOpenXREnabled
6565
{
6666
get
6767
{
68-
#if UNITY_2020_2_OR_NEWER && MSFT_OPENXR
68+
#if MSFT_OPENXR
6969
return XRSDKLoadersOfCurrentBuildTarget.Any(p => p.name.Contains("Open XR"));
7070
#else
7171
return false;
@@ -80,7 +80,7 @@ public static bool OpenXREnabled
8080
{
8181
get
8282
{
83-
#if UNITY_2020_2_OR_NEWER && XR_MANAGEMENT_ENABLED
83+
#if XR_MANAGEMENT_ENABLED
8484
return XRSDKLoadersOfCurrentBuildTarget.Any(p => p.name.Contains("Open XR"));
8585
#else
8686
return false;
@@ -149,7 +149,7 @@ public static bool XRManagementPresent
149149
}
150150
}
151151

152-
#if UNITY_2019_3_OR_NEWER
152+
#if UNITY_2019_3_OR_NEWER && !UNITY_2020_2_OR_NEWER
153153
private static bool? isXRSDKSuppressingLegacyXR = null;
154154

155155
static XRSettingsUtilities()
@@ -190,6 +190,8 @@ private static bool IsXRSDKSuppressingLegacyXR
190190
/// Called when packages are installed or uninstalled, to toggle a new check on XR SDK package installation status.
191191
/// </summary>
192192
private static void EditorApplication_projectChanged() => isXRSDKSuppressingLegacyXR = null;
193+
#endif // UNITY_2019_3_OR_NEWER && !UNITY_2020_2_OR_NEWER
194+
193195
#if XR_MANAGEMENT_ENABLED
194196
/// <summary>
195197
/// Retrieves the enabled XRSDK XR loaders (plugins) for the current build target
@@ -206,7 +208,6 @@ private static IReadOnlyList<XRLoader> XRSDKLoadersOfCurrentBuildTarget
206208
}
207209
}
208210
#endif // XR_MANAGEMENT_ENABLED
209-
#endif // UNITY_2019_3_OR_NEWER
210211

211212
/// <summary>
212213
/// Checks if an XR SDK plugin is installed that disables legacy XR. Returns false if so.

0 commit comments

Comments
 (0)