Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (32 sloc) 1005 Bytes
using Microsoft.MixedReality.Toolkit;
using System.Linq;
using Microsoft.MixedReality.Toolkit.SpatialAwareness;
using UnityEngine;
public class SpatialMapToggler : MonoBehaviour
{
public void ToggleSpatialMap()
{
if (CoreServices.SpatialAwarenessSystem != null)
{
if (IsObserverRunning)
{
CoreServices.SpatialAwarenessSystem.SuspendObservers();
CoreServices.SpatialAwarenessSystem.ClearObservations();
}
else
{
CoreServices.SpatialAwarenessSystem.ResumeObservers();
}
}
}
private bool IsObserverRunning
{
get
{
var providers =
((IMixedRealityDataProviderAccess)CoreServices.SpatialAwarenessSystem)
.GetDataProviders<IMixedRealitySpatialAwarenessObserver>();
return providers.FirstOrDefault()?.IsRunning == true;
}
}
}
You can’t perform that action at this time.