暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

PlayerLoopInspector.cs 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using UnityEngine.LowLevel;
  2. using UnityEngine.UIElements;
  3. namespace UnityEditor.U2D.Common
  4. {
  5. internal class PlayerLoopInspector : EditorWindow
  6. {
  7. [MenuItem("internal:Window/Player Loop Inspector")]
  8. static void ShowWindow()
  9. {
  10. var wind = GetWindow<PlayerLoopInspector>(false, "Player Loop");
  11. wind.Show();
  12. }
  13. void OnEnable()
  14. {
  15. Refresh();
  16. }
  17. void Refresh()
  18. {
  19. rootVisualElement.Clear();
  20. rootVisualElement.Add(new Button(Refresh) { text = "Refresh" });
  21. var scrollView = new ScrollView();
  22. rootVisualElement.Add(scrollView);
  23. var loop = PlayerLoop.GetCurrentPlayerLoop();
  24. ShowSystems(scrollView.contentContainer, loop.subSystemList, 0);
  25. }
  26. static void ShowSystems(VisualElement root, PlayerLoopSystem[] systems, int indent)
  27. {
  28. foreach (var playerLoopSystem in systems)
  29. {
  30. if (playerLoopSystem.subSystemList != null)
  31. {
  32. var foldout = new Foldout { text = playerLoopSystem.type.Name, style = { left = indent * 15 } };
  33. root.Add(foldout);
  34. ShowSystems(foldout, playerLoopSystem.subSystemList, indent + 1);
  35. }
  36. else
  37. {
  38. root.Add(new Label(playerLoopSystem.type.Name) { style = { left = indent * 15 } });
  39. }
  40. }
  41. }
  42. }
  43. }