Skip to content

Commit e990e10

Browse files
authored
Make eye gaze capability setting in configurator more consistent with the current MRTK profile (#10525)
* Move to better assembly * Only enable the gaze capability if the current MRTK profile says to * Better null checks * Add message box in case the capability isn't set * Add button to set the capability
1 parent b476960 commit e990e10

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Assets/MRTK/Core/Inspectors/Profiles/MixedRealityPointerProfileInspector.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public class MixedRealityPointerProfileInspector : BaseMixedRealityToolkitConfig
1919
private static readonly GUIContent UseEyeTrackingDataContent = new GUIContent("Use Eye Tracking Data");
2020
private static readonly GUIContent RaycastLayerMaskContent = new GUIContent("Default Raycast LayerMasks");
2121

22+
#if UNITY_2019_3_OR_NEWER
23+
private const string EnableGazeCapabilityContent = "To use eye tracking with UWP, the GazeInput capability needs to be set in the manifest." +
24+
"\nPlease click the button below to set it in the Unity UWP Player Settings and check the Visual Studio appxmanifest capabilities to ensure it's enabled.";
25+
#endif // UNITY_2019_3_OR_NEWER
26+
2227
private const string ProfileTitle = "Pointer Settings";
2328
private const string ProfileDescription = "Pointers attach themselves onto controllers as they are initialized.";
2429

@@ -91,6 +96,17 @@ public override void OnInspectorGUI()
9196
InspectorUIUtility.RenderDocumentationButton(helpURL);
9297
EditorGUILayout.EndHorizontal();
9398

99+
#if UNITY_2019_3_OR_NEWER
100+
if (useEyeTrackingDataWhenAvailable.boolValue && MixedRealityOptimizeUtils.IsBuildTargetUWP() && !PlayerSettings.WSA.GetCapability(PlayerSettings.WSACapability.GazeInput))
101+
{
102+
EditorGUILayout.HelpBox(EnableGazeCapabilityContent, MessageType.Warning);
103+
if (InspectorUIUtility.RenderIndentedButton("Set GazeInput capability"))
104+
{
105+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.GazeInput, true);
106+
}
107+
}
108+
#endif // UNITY_2019_3_OR_NEWER
109+
94110
EditorGUILayout.Space();
95111

96112
var gazeProvider = CameraCache.Main.GetComponent<IMixedRealityGazeProvider>();
@@ -253,4 +269,4 @@ private void RenderPointerList(SerializedProperty list)
253269
}
254270
}
255271
}
256-
}
272+
}

Assets/MRTK/Core/Utilities/Editor/Setup/MixedRealityProjectConfigurator.cs renamed to Assets/MRTK/Core/Inspectors/Setup/MixedRealityProjectConfigurator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ public bool IsActiveBuildTargetValid()
132132
{ Configurations.MicrophoneCapability, new ConfigGetter(() => GetCapability(PlayerSettings.WSACapability.Microphone), BuildTarget.WSAPlayer) },
133133
{ Configurations.InternetClientCapability, new ConfigGetter(() => GetCapability(PlayerSettings.WSACapability.InternetClient), BuildTarget.WSAPlayer) },
134134
#if UNITY_2019_3_OR_NEWER
135-
{ Configurations.EyeTrackingCapability, new ConfigGetter(() => GetCapability(PlayerSettings.WSACapability.GazeInput), BuildTarget.WSAPlayer) },
135+
{ Configurations.EyeTrackingCapability, new ConfigGetter(() => GetCapability(PlayerSettings.WSACapability.GazeInput)
136+
|| !(CoreServices.InputSystem != null
137+
&& CoreServices.InputSystem.InputSystemProfile != null
138+
&& CoreServices.InputSystem.InputSystemProfile.PointerProfile != null
139+
&& CoreServices.InputSystem.InputSystemProfile.PointerProfile.IsEyeTrackingEnabled), BuildTarget.WSAPlayer) },
136140
#endif // UNITY_2019_3_OR_NEWER
137141

138142
#if UNITY_2019_3_OR_NEWER

0 commit comments

Comments
 (0)