File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
MixedRealityToolkit.Providers/WindowsVoiceInput
MixedRealityToolkit.Services/SpatialAwarenessSystem Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,17 @@ public WindowsDictationInputProvider(
7373 private readonly WaitUntil waitUntilDictationRecognizerHasStarted = new WaitUntil ( ( ) => dictationRecognizer . Status != SpeechSystemStatus . Stopped ) ;
7474 private readonly WaitUntil waitUntilDictationRecognizerHasStopped = new WaitUntil ( ( ) => dictationRecognizer . Status != SpeechSystemStatus . Running ) ;
7575
76+ #if UNITY_EDITOR
77+ /// <inheritdoc />
78+ public override void Initialize ( )
79+ {
80+ if ( ! UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
81+ {
82+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , true ) ;
83+ }
84+ }
85+ #endif // UNITY_EDITOR
86+
7687 /// <inheritdoc />
7788 public override void Enable ( )
7889 {
@@ -130,8 +141,16 @@ public override async void Disable()
130141 }
131142 }
132143
144+ /// <inheritdoc />
133145 public override void Destroy ( )
134146 {
147+ #if UNITY_EDITOR
148+ if ( UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
149+ {
150+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , false ) ;
151+ }
152+ #endif // UNITY_EDITOR
153+
135154 if ( Application . isPlaying )
136155 {
137156 dictationRecognizer ? . Dispose ( ) ;
Original file line number Diff line number Diff line change @@ -51,6 +51,17 @@ public bool IsRecognitionActive
5151
5252 public RecognitionConfidenceLevel RecognitionConfidenceLevel { get ; set ; }
5353
54+ #if UNITY_EDITOR
55+ /// <inheritdoc />
56+ public override void Initialize ( )
57+ {
58+ if ( ! UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
59+ {
60+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , true ) ;
61+ }
62+ }
63+ #endif // UNITY_EDITOR
64+
5465 /// <inheritdoc />
5566 public override void Enable ( )
5667 {
@@ -101,6 +112,17 @@ public override void Disable()
101112 }
102113 }
103114
115+ #if UNITY_EDITOR
116+ /// <inheritdoc />
117+ public override void Destroy ( )
118+ {
119+ if ( UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
120+ {
121+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , false ) ;
122+ }
123+ }
124+ #endif // UNITY_EDITOR
125+
104126 /// <inheritdoc />
105127 public void StartRecognition ( )
106128 {
Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ public override void Initialize()
3737 private void InitializeInternal ( )
3838 {
3939 meshEventData = new MixedRealitySpatialAwarenessEventData < SpatialAwarenessMeshObject > ( EventSystem . current ) ;
40+
41+ #if UNITY_EDITOR
42+ if ( ! UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception ) )
43+ {
44+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception , true ) ;
45+ }
46+ #endif // UNITY_EDITOR
4047 }
4148
4249 /// <inheritdoc/>
@@ -79,6 +86,13 @@ public override void Reset()
7986 /// <inheritdoc/>
8087 public override void Destroy ( )
8188 {
89+ #if UNITY_EDITOR
90+ if ( UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception ) )
91+ {
92+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception , false ) ;
93+ }
94+ #endif // UNITY_EDITOR
95+
8296 // Cleanup game objects created during execution.
8397 if ( Application . isPlaying )
8498 {
You can’t perform that action at this time.
0 commit comments