当前位置:   article > 正文

编辑器拓展 CustomEditor_customeditor 隐藏字段

customeditor 隐藏字段
using UnityEngine;
using System.Collections;
using UnityEditor ;
//自定义样式的脚本
[CustomEditor(typeof(CubeScript))]
public class EditorTest :Editor {
//自定义Inspector视图
public override void OnInspectorGUI(){
EditorGUILayout.Foldout (true,"装备属性");
EditorGUILayout .PrefixLabel ("人物属性");
    //自定义之后,该脚本是一个target类型对象,将强转为CubeScript
CubeScript cubeScript =(CubeScript)target ;
// 在属性面板里绘制label
EditorGUILayout .LabelField("隐藏属性了!");
EditorGUILayout .Toggle ("开关",true);
EditorGUILayout .Toggle (true);
EditorGUILayout .TextField ("输入框","HelloWorld");
EditorGUILayout .ObjectField ("选择物体",cubeScript.obj ,cubeScript.objType,true);


cubeScript .layer =EditorGUILayout .LayerField ("层",cubeScript .layer);
string[] str = {"我不懂这个方法","调试","懂了"};
cubeScript.dex =EditorGUILayout .Popup ("下拉",cubeScript .dex,str);
cubeScript .speed = EditorGUILayout .Slider ("普通攻击力",cubeScript .speed,0f,2000f);
cubeScript .Empower_Spell = EditorGUILayout .IntSlider ("法术强度",cubeScript .Empower_Spell,0,800);
// cubeScript .v = EditorGUILayout.BeginScrollView (cubeScript .v, true,true);
// cubeScript .w =EditorGUILayout.EndScrollView (cubeScript.v,true,true);
cubeScript.isRun =EditorGUILayout.Toggle ("你不知道这是什么",cubeScript.isRun);
}
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
  

闽ICP备14008679号