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