From 6561dea0efd0d4593bbff52f1dc0f55a043234e7 Mon Sep 17 00:00:00 2001 From: Kurtis Date: Fri, 25 Sep 2026 13:50:28 -0700 Subject: [PATCH] Fix CS0414 warning for confidenceLevel in Windows speech configs (#208) --- org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md | 6 ++++++ .../Subsystems/WindowsDictationSubsystemConfig.cs | 13 +++++++++++-- .../WindowsKeywordRecognitionSubsystemConfig.cs | 13 +++++++++++-- org.mixedrealitytoolkit.windowsspeech/package.json | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md b/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md index e7fb1a7de..1ce676e93 100644 --- a/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md +++ b/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md @@ -2,6 +2,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## Unreleased + +### Fixed + +* Fixed compiler warning CS0414 for `confidenceLevel` on non-Windows platforms in `WindowsKeywordRecognitionSubsystemConfig` and `WindowsDictationSubsystemConfig`. [PR #1145](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1145) + ## [3.0.4] - 2025-11-12 ### Changed diff --git a/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsDictationSubsystemConfig.cs b/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsDictationSubsystemConfig.cs index 332b5721e..c0addbaad 100644 --- a/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsDictationSubsystemConfig.cs +++ b/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsDictationSubsystemConfig.cs @@ -32,14 +32,23 @@ public class WindowsDictationSubsystemConfig : BaseSubsystemConfig [SerializeField, Tooltip("The confidence threshold for the recognizer to return its result.")] private WindowsSpeechConfidenceLevel confidenceLevel = WindowsSpeechConfidenceLevel.Medium; + /// + /// The recognition confidence level for this subsystem configuration. + /// + internal WindowsSpeechConfidenceLevel SpeechConfidenceLevel + { + get => confidenceLevel; + set => confidenceLevel = value; + } + #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_WSA /// /// The confidence threshold for the recognizer to return its result. /// public ConfidenceLevel ConfidenceLevel { - get => confidenceLevel.ToUnityConfidenceLevel(); - set => confidenceLevel = value.ToWindowsSpeechConfidenceLevel(); + get => SpeechConfidenceLevel.ToUnityConfidenceLevel(); + set => SpeechConfidenceLevel = value.ToWindowsSpeechConfidenceLevel(); } #endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN } diff --git a/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsKeywordRecognitionSubsystemConfig.cs b/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsKeywordRecognitionSubsystemConfig.cs index 4778a53dc..aa8a0b541 100644 --- a/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsKeywordRecognitionSubsystemConfig.cs +++ b/org.mixedrealitytoolkit.windowsspeech/Subsystems/WindowsKeywordRecognitionSubsystemConfig.cs @@ -20,14 +20,23 @@ public class WindowsKeywordRecognitionSubsystemConfig : BaseSubsystemConfig [SerializeField, Tooltip("The confidence threshold for the recognizer to return its result.")] private WindowsSpeechConfidenceLevel confidenceLevel = WindowsSpeechConfidenceLevel.Medium; + /// + /// The recognition confidence level for this subsystem configuration. + /// + internal WindowsSpeechConfidenceLevel SpeechConfidenceLevel + { + get => confidenceLevel; + set => confidenceLevel = value; + } + #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_WSA /// /// The confidence threshold for the recognizer to return its result. /// public ConfidenceLevel ConfidenceLevel { - get => confidenceLevel.ToUnityConfidenceLevel(); - set => confidenceLevel = value.ToWindowsSpeechConfidenceLevel(); + get => SpeechConfidenceLevel.ToUnityConfidenceLevel(); + set => SpeechConfidenceLevel = value.ToWindowsSpeechConfidenceLevel(); } #endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN } diff --git a/org.mixedrealitytoolkit.windowsspeech/package.json b/org.mixedrealitytoolkit.windowsspeech/package.json index 2f287bb69..bde3c402a 100644 --- a/org.mixedrealitytoolkit.windowsspeech/package.json +++ b/org.mixedrealitytoolkit.windowsspeech/package.json @@ -1,6 +1,6 @@ { "name": "org.mixedrealitytoolkit.windowsspeech", - "version": "3.0.4-development", + "version": "3.0.5-development", "description": "Speech subsystem implementation for native Windows speech APIs enables native Windows text-to-speech and speech recognition features, producing events to drive XRI interactions using speech.", "displayName": "MRTK Windows Speech", "msftFeatureCategory": "MRTK3",