diff --git a/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset b/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset index 8ca8223..476ec44 100644 --- a/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset +++ b/Assets/MixedRealityToolkit.Generated/CustomProfiles/CYL MixedRealityToolkitConfigurationProfile.asset @@ -39,7 +39,7 @@ MonoBehaviour: spatialAwarenessSystemType: reference: Microsoft.MixedReality.Toolkit.SpatialAwareness.MixedRealitySpatialAwarenessSystem, Microsoft.MixedReality.Toolkit.Services.SpatialAwarenessSystem - spatialAwarenessSystemProfile: {fileID: 11400000, guid: 97da727944a3d7b4caf42d2273271a24, type: 2} + spatialAwarenessSystemProfile: {fileID: 11400000, guid: bacc3ee1fe0019e488dcc47839b347a6, type: 2} diagnosticsSystemProfile: {fileID: 11400000, guid: 478436bd1083882479a52d067e98e537, type: 2} enableDiagnosticsSystem: 0 diagnosticsSystemType: diff --git a/Assets/Script/UI/ToggleRoomMesh.cs b/Assets/Script/UI/ToggleRoomMesh.cs index 7f64ab3..eccdc06 100644 --- a/Assets/Script/UI/ToggleRoomMesh.cs +++ b/Assets/Script/UI/ToggleRoomMesh.cs @@ -6,21 +6,21 @@ public class ToggleRoomMesh : MonoBehaviour { - public IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem; + public IMixedRealitySpatialAwarenessMeshObserver observer; public bool spatialMeshEnabled = false; void Start() { // 获取Spatial Awareness系统 - spatialAwarenessSystem = CoreServices.SpatialAwarenessSystem; + observer = CoreServices.GetSpatialAwarenessSystemDataProvider(); - if (spatialAwarenessSystem == null) + if (observer == null) { Debug.LogError("Spatial Awareness System is not available."); } else { - spatialAwarenessSystem.SuspendObservers(); + observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Occlusion; spatialMeshEnabled = false; } } @@ -28,19 +28,16 @@ void Start() // 当按钮被按下时调用 public void OnButtonPress() { - if (spatialAwarenessSystem != null) + if (observer != null) { if (spatialMeshEnabled) { - // 关闭环境网格的显示 - spatialAwarenessSystem.ClearObservations(); - spatialAwarenessSystem.SuspendObservers(); + observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Occlusion; spatialMeshEnabled = false; } else { - // 启用环境网格的显示 - spatialAwarenessSystem.ResumeObservers(); + observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Visible; spatialMeshEnabled = true; } }