-
-
Save Novack/b9361a5b84685328a870632f8c191f0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine.LowLevel; | |
using UnityEngine.UIElements; | |
public class ShowPlayerLoopWindow : EditorWindow | |
{ | |
[MenuItem("Window/Player Loop")] | |
static void ShowWindow() | |
{ | |
var wind = GetWindow<ShowPlayerLoopWindow>(false, "Player Loop"); | |
wind.Show(); | |
} | |
void OnEnable() | |
{ | |
var scrollView = new ScrollView(); | |
rootVisualElement.Add(scrollView); | |
var loop = PlayerLoop.GetCurrentPlayerLoop(); | |
ShowSystems(scrollView.contentContainer, loop.subSystemList, 0); | |
} | |
static void ShowSystems(VisualElement root, PlayerLoopSystem[] systems, int indent) | |
{ | |
foreach (var playerLoopSystem in systems) | |
{ | |
if (playerLoopSystem.subSystemList != null) | |
{ | |
var foldout = new Foldout{ text = playerLoopSystem.type.Name, style = { left = indent * 15 }}; | |
root.Add(foldout); | |
ShowSystems(foldout, playerLoopSystem.subSystemList, indent + 1); | |
} | |
else | |
{ | |
root.Add(new Label(playerLoopSystem.type.Name){ style = { left = indent * 15 }}); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment