Skip to content

Commit 6674ea7

Browse files
authored
Merge pull request #219 from lalo13/CapsFeature
Added menu item to enable recommended capabilities
2 parents cb2393b + f8cae6f commit 6674ea7

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed

Assets/HoloToolkit/Utilities/Editor/ConfigureMenu.cs

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ 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-
public static class AutoConfigureMenu
17+
18+
19+
public class AutoConfigureMenu : UnityEditor.EditorWindow
1820
{
19-
[MenuItem("HoloToolkit/Configure/Show Help", priority = 1)]
21+
22+
[MenuItem("HoloToolkit/Configure/Show Help", priority = 2)]
2023
public static void ShowHelp()
2124
{
2225
Application.OpenURL("https://developer.microsoft.com/en-us/windows/holographic/unity_development_overview#Configuring_a_Unity_project_for_HoloLens");
@@ -187,5 +190,67 @@ private static void EnableVirtualReality()
187190
Debug.LogException(e);
188191
}
189192
}
193+
194+
[MenuItem("HoloToolkit/Configure/Apply HoloLens Capability Settings", priority = 1)]
195+
static void ApplyHoloLensCapabilitySettings()
196+
{
197+
AutoConfigureMenu window = (AutoConfigureMenu)EditorWindow.GetWindow(typeof(AutoConfigureMenu), true, "Apply HoloLens Capability Settings");
198+
window.Show();
199+
}
200+
201+
void OnGUI()
202+
{
203+
capabilityToggle(PlayerSettings.WSACapability.Microphone, @"Microphone
204+
205+
Required for access to the HoloLens microphone.
206+
This includes behaviors like DictationRecognizer,
207+
GrammarRecognizer, and KeywordRecognizer.
208+
This capability is NOT required for the 'Select' keyword.
209+
210+
Recommendation: Only enable if your application
211+
needs access to the microphone beyond the
212+
'Select' keyword. The microphone is considered a
213+
privacy sensitive resource.");
214+
215+
capabilityToggle(PlayerSettings.WSACapability.SpatialPerception, @"SpatialPerception
216+
217+
Required for access to the HoloLens world mapping
218+
capabilities. These include behaviors like
219+
SurfaceObserver, SpatialMappingManager and
220+
SpatialAnchor.
221+
222+
Recommendation: Enabled, unless your application
223+
doesn't use spatial mapping or spatial collisions
224+
in any way. ");
225+
226+
capabilityToggle(PlayerSettings.WSACapability.WebCam, @"WebCam
227+
228+
Required for access to the HoloLens RGB camera
229+
(also known as the locatable camera). This
230+
includes APIs like PhotoCapture and VideoCapture.
231+
This capability is NOT required for mixed reality
232+
streaming or for capturing photos or videos using
233+
the start menu.
234+
235+
Recommendation: Only enable if your application
236+
needs to programmatically capture photos or
237+
videos from the RGB camera. The RGB camera is
238+
considered a privacy sensitive resource.");
239+
240+
capabilityToggle(PlayerSettings.WSACapability.InternetClient, @"Internet Client
241+
242+
Required if your application needs to access
243+
the Internet.
244+
245+
Recommendation: Leave unchecked unless your
246+
application uses online services.");
247+
}
248+
249+
void capabilityToggle(PlayerSettings.WSACapability mCap,string tooltip)
250+
{
251+
PlayerSettings.WSA.SetCapability(mCap, GUILayout.Toggle(PlayerSettings.WSA.GetCapability(mCap), new GUIContent(" " + mCap.ToString(), tooltip)));
252+
}
253+
254+
190255
}
191256
}

0 commit comments

Comments
 (0)