Editor------------------CustomEditor

来源:互联网 发布:淘宝跳失率怎么计算 编辑:程序博客网 时间:2024/06/05 20:13

Editor总览


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函数。此函数是虚函数。

0 0
原创粉丝点击