利用Editor.finishedDefaultHeaderGUI这个回调可以实现自定义Header菜单
using UnityEditor;
using UnityEngine;
namespace Yaojz
{
[InitializeOnLoad]
public static class DefaultHeaderDrawer
{
static DefaultHeaderDrawer()
{
Editor.finishedDefaultHeaderGUI += OnDefaultHeaderGUI;
}
private static void OnDefaultHeaderGUI(Editor editor)
{
var go = editor.target as GameObject;
if(go == null)
{
return;
}
var ps = go.GetComponent<ParticleSystem>();
if (ps != null)
{
if (GUILayout.Button("Test"))
{
}
}
}
}
}
标签:OnDefaultHeaderGUI,Header,Unity,static,Editor,go,finishedDefaultHeaderGUI
From: https://www.cnblogs.com/terrynoya/p/18030407