using UnityEngine;
using UnityEditor;
//CustomEditor(typeof()) 用于关联自定义的脚本
[CustomEditor(typeof(LevelEditor))]
public class MyCustomEditor : Editor
{
LevelEditor levelEditor;
//每次点击挂载LevelEditor脚本对象时调用
void OnEnable()
{
//获取当前编辑自定义Inspector的对象
levelEditor = (LevelEditor)target;
}
}
1、"EditorGUILayout."的方法来描述levelEditor脚本的每个属性;
如: levelEditor.gameTime = EditorGUILayout.IntField(“游戏时长”, levelEditor.gameTime);
2、编辑器显示数组或列表
using UnityEngine;
using UnityEditor;
//CustomEditor(typeof()) 用于关联自定义的脚本
[CustomEditor(