|
7 | 7 | using Microsoft.MixedReality.Toolkit.Core.Interfaces.BoundarySystem; |
8 | 8 | using Microsoft.MixedReality.Toolkit.Core.Interfaces.Diagnostics; |
9 | 9 | using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem; |
| 10 | +using Microsoft.MixedReality.Toolkit.Core.Interfaces.SpatialAwarenessSystem; |
10 | 11 | using Microsoft.MixedReality.Toolkit.Core.Interfaces.TeleportSystem; |
11 | 12 | using Microsoft.MixedReality.Toolkit.Core.Utilities; |
12 | 13 | using System; |
@@ -195,6 +196,16 @@ private void Initialize() |
195 | 196 | } |
196 | 197 |
|
197 | 198 |
|
| 199 | + // If the Spatial Awareness system has been selected for initialization in the Active profile, enable it in the project |
| 200 | + if (ActiveProfile.IsSpatialAwarenessSystemEnabled) |
| 201 | + { |
| 202 | + if (!RegisterService(typeof(IMixedRealitySpatialAwarenessSystem), Activator.CreateInstance(ActiveProfile.SpatialAwarenessSystemSystemType) as IMixedRealitySpatialAwarenessSystem) || |
| 203 | + SpatialAwarenessSystem == null) |
| 204 | + { |
| 205 | + Debug.LogError("Failed to start the Spatial Awareness System!"); |
| 206 | + } |
| 207 | + } |
| 208 | + |
198 | 209 | // If the Teleport system has been selected for initialization in the Active profile, enable it in the project |
199 | 210 | if (ActiveProfile.IsTeleportSystemEnabled) |
200 | 211 | { |
@@ -1030,6 +1041,7 @@ private bool IsCoreSystem(Type type) |
1030 | 1041 | return typeof(IMixedRealityInputSystem).IsAssignableFrom(type) || |
1031 | 1042 | typeof(IMixedRealityTeleportSystem).IsAssignableFrom(type) || |
1032 | 1043 | typeof(IMixedRealityBoundarySystem).IsAssignableFrom(type) || |
| 1044 | + typeof(IMixedRealitySpatialAwarenessSystem).IsAssignableFrom(type) || |
1033 | 1045 | typeof(IMixedRealityDiagnosticsSystem).IsAssignableFrom(type); |
1034 | 1046 | } |
1035 | 1047 |
|
@@ -1160,6 +1172,13 @@ private static bool CheckComponentMatch(Type type, string serviceName, Tuple<Typ |
1160 | 1172 | /// </summary> |
1161 | 1173 | public static IMixedRealityBoundarySystem BoundarySystem => boundarySystem ?? (boundarySystem = Instance.GetService<IMixedRealityBoundarySystem>()); |
1162 | 1174 |
|
| 1175 | + private static IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem = null; |
| 1176 | + |
| 1177 | + /// <summary> |
| 1178 | + /// The current Spatial Awareness System registered with the Mixed Reality Manager. |
| 1179 | + /// </summary> |
| 1180 | + public static IMixedRealitySpatialAwarenessSystem SpatialAwarenessSystem => spatialAwarenessSystem ?? (spatialAwarenessSystem = Instance.GetService<IMixedRealitySpatialAwarenessSystem>()); |
| 1181 | + |
1163 | 1182 | private static IMixedRealityTeleportSystem teleportSystem = null; |
1164 | 1183 |
|
1165 | 1184 | /// <summary> |
|
0 commit comments