Category item view button list
This commit is contained in:
parent
cd8c819585
commit
da89d7a7fc
23
Editor/ReadOnlyAttribute.cs
Normal file
23
Editor/ReadOnlyAttribute.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NegUtils.Editor
|
||||||
|
{
|
||||||
|
public class ReadOnlyAttribute : PropertyAttribute { }
|
||||||
|
|
||||||
|
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
|
||||||
|
public class ReadOnlyPropertyDrawer : PropertyDrawer
|
||||||
|
{
|
||||||
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||||
|
{
|
||||||
|
GUI.enabled = false;
|
||||||
|
EditorGUI.PropertyField(position, property, label, true);
|
||||||
|
GUI.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||||
|
{
|
||||||
|
return EditorGUI.GetPropertyHeight(property, label, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Editor/ReadOnlyAttribute.cs.meta
Normal file
3
Editor/ReadOnlyAttribute.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1f837bac3a7b40528454a9fb9a46d0be
|
||||||
|
timeCreated: 1699371332
|
||||||
Loading…
x
Reference in New Issue
Block a user