Skip to content

Commit 244576a

Browse files
authored
Don't register dictation subsystem on non-Windows (#1001)
1 parent 7728e0b commit 244576a

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

org.mixedrealitytoolkit.core/Subsystems/Speech/DictationSubsystemDescriptor.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ public class DictationSubsystemDescriptor :
5959
/// </returns>
6060
internal static DictationSubsystemDescriptor Create(DictationSubsystemCinfo cinfo)
6161
{
62-
// Validates cinfo.
63-
if (!XRSubsystemHelpers.CheckTypes<DictationSubsystem, DictationSubsystem.Provider>(cinfo.Name,
64-
cinfo.SubsystemTypeOverride,
65-
cinfo.ProviderType))
66-
{
67-
throw new ArgumentException("Could not create DictationSubsystemDescriptor.");
68-
}
62+
// Validates cinfo.
63+
if (!XRSubsystemHelpers.CheckTypes<DictationSubsystem, DictationSubsystem.Provider>(cinfo.Name,
64+
cinfo.SubsystemTypeOverride,
65+
cinfo.ProviderType))
66+
{
67+
throw new ArgumentException("Could not create DictationSubsystemDescriptor.");
68+
}
6969

70-
return new DictationSubsystemDescriptor(cinfo);
70+
return new DictationSubsystemDescriptor(cinfo);
7171
}
7272
}
7373
}

org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77
### Changed
88

9-
* Subsystem no longer registers itself on non-Windows platforms.
9+
* Subsystems no longer register themselves on non-Windows platforms.
1010

1111
## [3.0.3] - 2024-04-17
1212

org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsDictationSubsystem.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_WSA
99
using UnityEngine.Windows.Speech;
10-
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
10+
#endif // UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_WSA
1111

1212
namespace MixedReality.Toolkit.Speech.Windows
1313
{
1414
/// <summary>
1515
/// A Unity subsystem that extends <see cref="MixedReality.Toolkit.Subsystems.DictationSubsystem">DictationSubsystem</see>
1616
/// so to expose the dictation services available on Windows platforms. This subsystem is enabled for Windows Standalone and
17-
/// Universal Windows Applications.
17+
/// Universal Windows Applications.
1818
/// </summary>
1919
/// <remarks>
2020
/// This subsystem can be configured using the <see cref="MixedReality.Toolkit.Speech.Windows.WindowsDictationSubsystemConfig">WindowsDictationSubsystemConfig</see> Unity asset.
@@ -35,10 +35,14 @@ static void Register()
3535
// Fetch subsystem metadata from the attribute.
3636
var cinfo = XRSubsystemHelpers.ConstructCinfo<WindowsDictationSubsystem, DictationSubsystemCinfo>();
3737

38+
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_WSA
3839
if (!Register(cinfo))
3940
{
4041
Debug.LogError($"Failed to register the {cinfo.Name} subsystem.");
4142
}
43+
#else
44+
Debug.Log($"Skipping registration of the {cinfo.Name} subsystem due to running on an unsupported platform.");
45+
#endif
4246
}
4347

4448
/// <summary>

0 commit comments

Comments
 (0)