Skip to content

Commit 0ed51a9

Browse files
committed
Make the build work with the .NET backend again.
With the latest HL2 payload, a few changes got in that broke the .NET backend (a combination of usage of C# language features that don't work with the .NET backend, or weird interactions with the test assembly setup)
1 parent 9cc3453 commit 0ed51a9

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

Assets/MixedRealityToolkit.Examples/Demos/Gltf/Scripts/TestGlbLoading.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class TestGlbLoading : MonoBehaviour
1919

2020
private async void Start()
2121
{
22-
Response response = default;
22+
Response response = new Response();
2323

2424
try
2525
{

Assets/MixedRealityToolkit.Services/InputSystem/FocusProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ private static void QueryScene(PointerData pointerData, LayerMask[] prioritizedL
798798
case SceneQueryType.SimpleRaycast:
799799
if (MixedRealityRaycaster.RaycastSimplePhysicsStep(pointerRays[i], prioritizedLayerMasks, out physicsHit))
800800
{
801-
UpdatePointerRayOnHit(pointerData, pointerRays, in physicsHit, i, rayStartDistance);
801+
UpdatePointerRayOnHit(pointerData, pointerRays, physicsHit, i, rayStartDistance);
802802
return;
803803
}
804804
break;
@@ -808,7 +808,7 @@ private static void QueryScene(PointerData pointerData, LayerMask[] prioritizedL
808808
case SceneQueryType.SphereCast:
809809
if (MixedRealityRaycaster.RaycastSpherePhysicsStep(pointerRays[i], pointerData.Pointer.SphereCastRadius, prioritizedLayerMasks, out physicsHit))
810810
{
811-
UpdatePointerRayOnHit(pointerData, pointerRays, in physicsHit, i, rayStartDistance);
811+
UpdatePointerRayOnHit(pointerData, pointerRays, physicsHit, i, rayStartDistance);
812812
return;
813813
}
814814
break;
@@ -854,7 +854,7 @@ private static void QueryScene(PointerData pointerData, LayerMask[] prioritizedL
854854
}
855855
}
856856

857-
private static void UpdatePointerRayOnHit(PointerData pointerData, RayStep[] raySteps, in RaycastHit physicsHit, int hitRayIndex, float rayStartDistance)
857+
private static void UpdatePointerRayOnHit(PointerData pointerData, RayStep[] raySteps, RaycastHit physicsHit, int hitRayIndex, float rayStartDistance)
858858
{
859859
Vector3 origin = raySteps[hitRayIndex].Origin;
860860
Vector3 terminus = physicsHit.point;

Assets/MixedRealityToolkit.Tests/PlayModeTests/TestFixture_01_SimplePlayModeTest.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4+
#if !WINDOWS_UWP
5+
// When the .NET scripting backend is enabled and C# projects are built
6+
// Unity doesn't include the the required assemblies (i.e. the ones below).
7+
// Given that the .NET backend is deprecated by Unity at this point it's we have
8+
// to work around this on our end.
49
using NUnit.Framework;
10+
using System.Collections;
511
using UnityEngine;
612
using UnityEngine.TestTools;
7-
using System.Collections;
813

914
namespace Microsoft.MixedReality.Toolkit.Tests
1015
{
@@ -47,10 +52,6 @@ public IEnumerator Test01_WhizzySphere()
4752
}
4853
stopwatch.Stop();
4954
}
50-
51-
[TearDown]
52-
public void TearDown()
53-
{
54-
}
5555
}
56-
}
56+
}
57+
#endif

Assets/MixedRealityToolkit.Tests/TestUtilities.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4-
using Microsoft.MixedReality.Toolkit.Editor;
5-
using NUnit.Framework;
64
using System.Collections;
75
using System.Linq;
86
using UnityEngine;
97
using UnityEngine.SceneManagement;
108

119
#if UNITY_EDITOR
10+
using Microsoft.MixedReality.Toolkit.Editor;
11+
using NUnit.Framework;
1212
using UnityEditor;
1313
using UnityEditor.SceneManagement;
1414
#endif
1515

16+
#if WINDOWS_UWP
17+
using UnityEngine.Assertions;
18+
#endif
19+
1620
namespace Microsoft.MixedReality.Toolkit.Tests
1721
{
1822
public static class TestUtilities
@@ -76,9 +80,13 @@ public static void InitializeMixedRealityToolkitScene(bool useDefaultProfile = f
7680
}
7781
}
7882

79-
public static T GetDefaultMixedRealityProfile<T>() where T : BaseMixedRealityProfile
83+
private static T GetDefaultMixedRealityProfile<T>() where T : BaseMixedRealityProfile
8084
{
85+
#if UNITY_EDITOR
8186
return ScriptableObjectExtensions.GetAllInstances<T>().FirstOrDefault(profile => profile.name.Equals($"Default{typeof(T).Name}"));
87+
#else
88+
return ScriptableObject.CreateInstance<T>();
89+
#endif
8290
}
8391
}
8492
}

0 commit comments

Comments
 (0)