Skip to content

Commit

Permalink
Fixing regression in MRTK3's Profile Editor (#11694)
Browse files Browse the repository at this point in the history
The #11681 pull request removed the spatialization mixer property from the MRTK3 Profile, but neglected to remove the reference from the associated editor component.

This change removes the spatialization mixer from the editor component.  Also adding a unit test to help ensure this doesn't break again.
  • Loading branch information
AMollis committed Jul 10, 2023
1 parent ee4b286 commit 5097c99
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 15 deletions.
15 changes: 0 additions & 15 deletions com.microsoft.mrtk.core/Editor/Editors/MRTKProfileEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Text;
using UnityEditor;
using UnityEngine;
using UnityEngine.Audio;

namespace Microsoft.MixedReality.Toolkit.Editor
{
Expand Down Expand Up @@ -188,10 +187,6 @@ private static class Styles
// subsystem types to config ScriptableObjects.
private SerializedProperty serializedConfigs;

// The serialized audio mixer group that is to be
// used when playing spatiailized sounds.
private SerializedProperty serializedMixerGroup;

// All concrete subsystems in currently loaded assemblies,
// which are tagged with the MRTKSubsystemAttribute.
private SortedDictionary<string, List<SubsystemItem>> allSubsystemTypes = new SortedDictionary<string, List<SubsystemItem>>(StringComparer.InvariantCultureIgnoreCase);
Expand All @@ -218,7 +213,6 @@ private void OnEnable()
{
serializedSubsystems = serializedObject.FindProperty("loadedSubsystems");
serializedConfigs = serializedObject.FindProperty("subsystemConfigs");
serializedMixerGroup = serializedObject.FindProperty(InspectorUIUtility.GetBackingField("SpatializationMixer"));
}

public override void OnInspectorGUI()
Expand All @@ -245,8 +239,6 @@ public override void OnInspectorGUI()
+ ".\nCheck the MR Feature Tool to import missing subsystems.", MessageType.Warning);
}

DrawSelectedMixer();

using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
{
DrawSubsystemList();
Expand All @@ -258,13 +250,6 @@ public override void OnInspectorGUI()

#region Drawing methods

private void DrawSelectedMixer()
{
EditorGUILayout.ObjectField(
serializedMixerGroup,
typeof(AudioMixerGroup));
}

/// <summary>
/// Draws the display name, author, and full name of the specified subsystem.
/// </summary>
Expand Down
40 changes: 40 additions & 0 deletions com.microsoft.mrtk.core/Tests/Editor/MRTK3ProfileEditorTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using NUnit.Framework;
using System.Collections;
using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
using UnityEngine.UIElements;

namespace Microsoft.MixedReality.Toolkit.Core.Tests.EditMode
{
internal class MRTK3ProfileEditorTest
{
/// <summary>
/// Verify that the <see cref="MRTK3ProfileEditor"/> window can be opened.
/// </summary>
/// <remarks>
/// This test is disabled when executing in batch mode, since it requires a Unity graphic device.
/// </remarks>
[UnityTest]
public IEnumerator InspectorWindowSmokeTest()
{
if (Application.isBatchMode)
{
yield return null;
}
else
{
var window = SettingsService.OpenProjectSettings("Project/MRTK3");
Assert.IsNotNull(window, "The MRTK Profile editor window should have been opened");

var panel = window.rootVisualElement.Query<IMGUIContainer>(className: "settings-panel-imgui-container").First();
Assert.IsNotNull(panel, "There should have hand a settings panel created for the MRTK Profile.");

yield return null;
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5097c99

Please sign in to comment.