24 lines
583 B
C#
24 lines
583 B
C#
using System;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Qjjxk.Blur
|
|
{
|
|
[AttributeUsage(AttributeTargets.Field)]
|
|
public class ReadOnlyAttribute : PropertyAttribute
|
|
{
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
|
|
public class ReadOnlyDrawer : PropertyDrawer
|
|
{
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
GUI.enabled = false;
|
|
EditorGUI.PropertyField(position, property, label);
|
|
GUI.enabled = true;
|
|
}
|
|
}
|
|
#endif
|
|
} |