Skip to content

Commit c7e7537

Browse files
committed
Using an EditorWindow to enable or disable capabilities instead of menu item.
1 parent f3473a9 commit c7e7537

File tree

1 file changed

+47
-14
lines changed

1 file changed

+47
-14
lines changed

Assets/HoloToolkit/Utilities/Editor/ConfigureMenu.cs

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ namespace HoloToolkit.Unity
1414
/// Configuration options derived from here:
1515
/// https://developer.microsoft.com/en-us/windows/holographic/unity_development_overview#Configuring_a_Unity_project_for_HoloLens
1616
/// </summary>
17-
18-
public static class AutoConfigureMenu
17+
18+
19+
public class AutoConfigureMenu : UnityEditor.EditorWindow
1920
{
20-
21+
2122
[MenuItem("HoloToolkit/Configure/Show Help", priority = 2)]
2223
public static void ShowHelp()
2324
{
@@ -190,24 +191,56 @@ private static void EnableVirtualReality()
190191
}
191192
}
192193

193-
private static void ApplyCommonCapabilities()
194+
[MenuItem("HoloToolkit/Configure/HoloLens Recommended Capabilities ", priority = 1)]
195+
static void HoloLensRecommendedCapabilities()
194196
{
195-
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.Microphone, true);
196-
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.SpatialPerception, true);
197-
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.WebCam, true);
197+
AutoConfigureMenu window = (AutoConfigureMenu)EditorWindow.GetWindow(typeof(AutoConfigureMenu), true, "HoloLens Recommended Capabilities");
198+
window.Show();
198199
}
199200

200-
[MenuItem("HoloToolkit/Configure/Apply HoloLens Capabilities/Recommended", priority = 1)]
201-
private static void ApplyRecommendedCapabilities()
201+
void OnGUI()
202202
{
203-
ApplyCommonCapabilities();
203+
capability(PlayerSettings.WSACapability.Microphone, @" Microphone
204+
Required for access to the HoloLens microphone.
205+
This includes behaviors like DictationRecognizer,
206+
GrammarRecognizer, and KeywordRecognizer.
207+
This capability is NOT required for the 'Select'
208+
keyword.Recommendation: Only enable if your
209+
application needs access to the microphone
210+
beyond the 'Select' keyword.The microphone is
211+
considered a privacy sensitive resource.");
212+
213+
capability(PlayerSettings.WSACapability.SpatialPerception, @" SpatialPerception
214+
Required for access to the HoloLens world mapping
215+
capabilities. These include behaviors like
216+
SurfaceObserver, SpatialMappingManager and
217+
SpatialAnchor. Recommendation: Enabled unless
218+
your application doesn't use spatial mapping or
219+
spatial collisions in any way.");
220+
221+
capability(PlayerSettings.WSACapability.WebCam, @" WebCam
222+
Required for access to the HoloLens RGB camera
223+
(also known as the locatable camera). This
224+
includes APIs like PhotoCapture and VideoCapture.
225+
This capability is NOT required for mixed reality
226+
streaming or for capture photos or videos from the
227+
start menu. Recommendation: Only enable if your
228+
application needs access to capture raw photos or
229+
videos from the RGB camera. The RGB camera is
230+
considered a privacy sensitive resource.");
231+
232+
capability(PlayerSettings.WSACapability.InternetClient, @" InternetClient
233+
Required if your application needs to access the
234+
Internet. Recommendation: Leave unchecked
235+
unless your application needs to access online
236+
services.");
204237
}
205238

206-
[MenuItem("HoloToolkit/Configure/Apply HoloLens Capabilities/Recommended with Internet Access", priority = 1)]
207-
private static void ApplyRecommendedCapabilitiesWithInternetAccess()
239+
void capability(PlayerSettings.WSACapability mCap,string tooltip)
208240
{
209-
ApplyCommonCapabilities();
210-
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClient, true);
241+
PlayerSettings.WSA.SetCapability(mCap, GUILayout.Toggle(PlayerSettings.WSA.GetCapability(mCap), new GUIContent(" " + mCap.ToString(), tooltip)));
211242
}
243+
244+
212245
}
213246
}

0 commit comments

Comments
 (0)