Skip to content

Commit a2eb460

Browse files
authored
Merge pull request #9613 from cre8ivepark/ExamplesHub_260_MergeMain
Merge updates from MRTK Examples Hub 2.6.0
2 parents 265a0ea + aba6598 commit a2eb460

28 files changed

+53248
-36948
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using UnityEngine;
5+
6+
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
7+
{
8+
/// <summary>
9+
/// Loads a given Mixed Reality Toolkit configuration profile.
10+
/// </summary>
11+
[AddComponentMenu("Scripts/MRTK/Examples/LoadProfile")]
12+
public class LoadProfile : MonoBehaviour
13+
{
14+
[Tooltip("Mixed Reality Toolkit profile to load.")]
15+
[SerializeField]
16+
private MixedRealityToolkitConfigurationProfile configProfile = null;
17+
18+
/// <summary>
19+
/// Loads a given Mixed Reality Toolkit configuration profile.
20+
/// </summary>
21+
public void LoadConfigProfile()
22+
{
23+
if ((configProfile != null) && (MixedRealityToolkit.Instance != null))
24+
{
25+
MixedRealityToolkit.Instance.ActiveProfile = configProfile;
26+
Debug.Log($"Loading new MRTK configuration profile: {configProfile.name}");
27+
configProfile = null;
28+
}
29+
}
30+
}
31+
}

Assets/MRTK/Examples/Common/Scripts/LoadProfile.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.MixedReality.Toolkit.SpatialAwareness;
5+
using UnityEngine;
6+
7+
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
8+
{
9+
/// <summary>
10+
/// This class controls the observer of the spatial mesh.
11+
/// </summary>
12+
[AddComponentMenu("Scripts/MRTK/Examples/ToggleSpatialMeshObserver")]
13+
public class ToggleSpatialMeshObserver : MonoBehaviour
14+
{
15+
/// <summary>
16+
/// Toggles the state of the mesh display option.
17+
/// </summary>
18+
public void ToggleSpatialMeshVisual(bool mode)
19+
{
20+
// Get the first Mesh Observer available, generally we have only one registered
21+
var observer = CoreServices.GetSpatialAwarenessSystemDataProvider<IMixedRealitySpatialAwarenessMeshObserver>();
22+
23+
if (mode == true)
24+
{
25+
observer.Resume();
26+
observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Visible;
27+
}
28+
else
29+
{
30+
observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.None;
31+
observer.Suspend();
32+
observer.ClearObservations();
33+
}
34+
}
35+
}
36+
}

Assets/MRTK/Examples/Common/Scripts/Toggle/ToggleSpatialMeshObserver.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)