CustormEditor一般与类Editor配合使用!以实现在Inspector面板中的自定义显示!
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(myType))]
public class menutest : Editor
{
public override void OnInspectorGUI()
{
myType s = target as myType;
// ........
}
}
使用时有几个注意点:
1、CustomEditor + typeof + 类名
2、自定义类是Editor的派生类
3、绘制自定义UI要重写OnInspectorGUI函数。此函数是虚函数。