18 lines
660 B
C#
18 lines
660 B
C#
using UnityEditor;
|
|
|
|
namespace Module.Inspector.Editor
|
|
{
|
|
[CustomPropertyDrawer(typeof(EnableField))]
|
|
internal sealed class DrawerEnableField : AccessModifierPropertyDrawer
|
|
{
|
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
|
{
|
|
var att = (EnableField)attribute;
|
|
|
|
if (currentAccessType == EAccessType.Enabled && !property.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue))
|
|
currentAccessType = EAccessType.ReadOnly;
|
|
|
|
return currentAccessType;
|
|
}
|
|
}
|
|
} |