查找UnityEditor的窗口类
把下面的代码保存为GetEditorWindowTool.cs
,放在Editor目录中。
using UnityEditor;public class GetEditorWindowTool
{[MenuItem("Tool/GetEditorWindow")]static void GetEditorWindow(){foreach(var item in Resources.FindObjectsOfTypeAll<EditorWindow>()){Debug.Log(item.GetType().ToString());}}
}
打开想要查看的引擎窗口&#xff0c;比如Profiler窗口

点击菜单Tool/GetEditorWindow
可以看到日志中输出了对应的窗口类名

反编译UnityEditor.dll&#xff08;通过ilspy&#xff09;
接着&#xff0c;找到Unity安装目录中的UnityEditor.dll
文件

通过ilspy对UnityEditor.dll进行反编译。
ilspy 下载地址&#xff1a;https://github.com/icsharpcode/ILSpy/releases
找到UnityEditor命名空间下的ProfilerWindow类&#xff0c;通过OnGUI函数&#xff0c;即可知道这个窗口的GUI代码了
