Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

InputActionDebuggerWindow.cs 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #if UNITY_EDITOR
  2. using System;
  3. using System.Collections.Generic;
  4. using UnityEditor;
  5. ////TODO: survive domain reload properly
  6. namespace UnityEngine.InputSystem.Editor
  7. {
  8. internal class InputActionDebuggerWindow : EditorWindow
  9. {
  10. [NonSerialized] private InputAction m_Action = null;
  11. public static void CreateOrShowExisting(InputAction action)
  12. {
  13. if (action == null)
  14. throw new System.ArgumentNullException(nameof(action));
  15. // See if we have an existing window for the action and if so pop it in front.
  16. if (s_OpenDebuggerWindows != null)
  17. {
  18. for (var i = 0; i < s_OpenDebuggerWindows.Count; ++i)
  19. {
  20. var existingWindow = s_OpenDebuggerWindows[i];
  21. if (ReferenceEquals(existingWindow.m_Action, action))
  22. {
  23. existingWindow.Show();
  24. existingWindow.Focus();
  25. return;
  26. }
  27. }
  28. }
  29. // No, so create a new one.
  30. var window = CreateInstance<InputActionDebuggerWindow>();
  31. window.Show();
  32. window.titleContent = new GUIContent(action.name);
  33. window.AddToList();
  34. }
  35. public void OnGUI()
  36. {
  37. }
  38. private static List<InputActionDebuggerWindow> s_OpenDebuggerWindows;
  39. private void AddToList()
  40. {
  41. if (s_OpenDebuggerWindows == null)
  42. s_OpenDebuggerWindows = new List<InputActionDebuggerWindow>();
  43. if (!s_OpenDebuggerWindows.Contains(this))
  44. s_OpenDebuggerWindows.Add(this);
  45. }
  46. private void RemoveFromList()
  47. {
  48. if (s_OpenDebuggerWindows != null)
  49. s_OpenDebuggerWindows.Remove(this);
  50. }
  51. }
  52. }
  53. #endif // UNITY_EDITOR