1.创建的标签名(SetProperty)
public class SetPropertyAttribute : PropertyAttribute
{
public string Name { get; private set; }
public bool IsDirty { get; set; }
public SetPropertyAttribute(string name)
{
this.Name = name;
}
}
2.在Editor文件夹创建
// Copyright (c) 2014 Luminary LLC
// Licensed under The MIT License (See LICENSE for full text)
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Reflection;
[CustomPropertyDrawer(typeof(SetPropertyAttribute))]
public class SetPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
// Rely on the default inspector GUI
EditorGUI.BeginChangeCh