Unity编辑器扩展秘籍-利用Editor.finishedDefaultHeaderGUI增加Header功能
利用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"))
{
}
}
}
}
}