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函數。此函數是虛函數。