GazeEditor.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using UnityEditor;
  2. using Ximmerse.XR.InputSystems.GazeAndGestureInteraction;
  3. [CustomEditor(typeof(GazeAndHandInteractionSystem))]
  4. public class GazeEditor : Editor
  5. {
  6. private SerializedObject gazeimage;
  7. private SerializedProperty EyeRayGO;
  8. private SerializedProperty cursor;
  9. private SerializedProperty normal;
  10. private SerializedProperty tracking;
  11. private SerializedProperty select;
  12. private SerializedProperty EyeRay;
  13. void OnEnable()
  14. {
  15. gazeimage = new SerializedObject(target);
  16. EyeRayGO = gazeimage.FindProperty("EyeRayGO");
  17. cursor = gazeimage.FindProperty("_cursorStateImage");
  18. normal = gazeimage.FindProperty("normal");
  19. tracking = gazeimage.FindProperty("tracking");
  20. select = gazeimage.FindProperty("select");
  21. EyeRay= gazeimage.FindProperty("_eyeRay");
  22. }
  23. public override void OnInspectorGUI()
  24. {
  25. gazeimage.Update();
  26. EditorGUILayout.PropertyField(cursor);
  27. if (cursor.enumValueIndex == 0)
  28. {
  29. EditorGUILayout.PropertyField(EyeRayGO);
  30. //EditorGUILayout.PropertyField(cursor);
  31. }
  32. else
  33. {
  34. EditorGUILayout.PropertyField(normal);
  35. EditorGUILayout.PropertyField(tracking);
  36. EditorGUILayout.PropertyField(select);
  37. EditorGUILayout.PropertyField(EyeRayGO);
  38. }
  39. if (EyeRayGO.enumValueIndex!=0)
  40. {
  41. EditorGUILayout.PropertyField(EyeRay);
  42. }
  43. gazeimage.ApplyModifiedProperties();
  44. }
  45. }