File tree Expand file tree Collapse file tree 3 files changed +64
-0
lines changed
MixedRealityToolkit.Providers/WindowsVoiceInput
MixedRealityToolkit.Services/SpatialAwarenessSystem Expand file tree Collapse file tree 3 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,22 @@ public WindowsDictationInputProvider(
7979 private readonly WaitUntil waitUntilDictationRecognizerHasStarted = new WaitUntil ( ( ) => dictationRecognizer . Status != SpeechSystemStatus . Stopped ) ;
8080 private readonly WaitUntil waitUntilDictationRecognizerHasStopped = new WaitUntil ( ( ) => dictationRecognizer . Status != SpeechSystemStatus . Running ) ;
8181
82+ #if UNITY_EDITOR
83+ /// <inheritdoc />
84+ public override void Initialize ( )
85+ {
86+ if ( ! UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
87+ {
88+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , true ) ;
89+ }
90+
91+ if ( ! UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . InternetClient ) )
92+ {
93+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . InternetClient , true ) ;
94+ }
95+ }
96+ #endif // UNITY_EDITOR
97+
8298 /// <inheritdoc />
8399 public override void Enable ( )
84100 {
@@ -151,6 +167,18 @@ public override async void Disable()
151167 /// <inheritdoc />
152168 public override void Destroy ( )
153169 {
170+ #if UNITY_EDITOR
171+ if ( UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
172+ {
173+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , false ) ;
174+ }
175+
176+ if ( UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . InternetClient ) )
177+ {
178+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . InternetClient , false ) ;
179+ }
180+ #endif // UNITY_EDITOR
181+
154182 if ( Application . isPlaying )
155183 {
156184 dictationRecognizer ? . Dispose ( ) ;
Original file line number Diff line number Diff line change @@ -59,6 +59,17 @@ public bool IsRecognitionActive
5959 get { return keywordRecognizer != null && keywordRecognizer . IsRunning ; }
6060 }
6161
62+ #if UNITY_EDITOR
63+ /// <inheritdoc />
64+ public override void Initialize ( )
65+ {
66+ if ( ! UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
67+ {
68+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , true ) ;
69+ }
70+ }
71+ #endif // UNITY_EDITOR
72+
6273 /// <inheritdoc />
6374 public override void Enable ( )
6475 {
@@ -117,6 +128,17 @@ public override void Disable()
117128 }
118129 }
119130
131+ #if UNITY_EDITOR
132+ /// <inheritdoc />
133+ public override void Destroy ( )
134+ {
135+ if ( UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone ) )
136+ {
137+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . Microphone , false ) ;
138+ }
139+ }
140+ #endif // UNITY_EDITOR
141+
120142 /// <inheritdoc />
121143 public void StartRecognition ( )
122144 {
Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ public override void Initialize()
3939 private void InitializeInternal ( )
4040 {
4141 meshEventData = new MixedRealitySpatialAwarenessEventData < SpatialAwarenessMeshObject > ( EventSystem . current ) ;
42+
43+ #if UNITY_EDITOR
44+ if ( ! UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception ) )
45+ {
46+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception , true ) ;
47+ }
48+ #endif // UNITY_EDITOR
4249 }
4350
4451 /// <inheritdoc/>
@@ -97,6 +104,13 @@ public override void Reset()
97104 /// <inheritdoc/>
98105 public override void Destroy ( )
99106 {
107+ #if UNITY_EDITOR
108+ if ( UnityEditor . PlayerSettings . WSA . GetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception ) )
109+ {
110+ UnityEditor . PlayerSettings . WSA . SetCapability ( UnityEditor . PlayerSettings . WSACapability . SpatialPerception , false ) ;
111+ }
112+ #endif // UNITY_EDITOR
113+
100114 // Cleanup game objects created during execution.
101115 if ( Application . isPlaying )
102116 {
You can’t perform that action at this time.
0 commit comments