17 lines
589 B
C#
17 lines
589 B
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Module.Inspector.Editor
|
|
{
|
|
[CustomPropertyDrawer(typeof(DisableFieldInPlayMode))]
|
|
internal sealed class DrawerDisableFieldInPlayMode : AccessModifierPropertyDrawer
|
|
{
|
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
|
{
|
|
if (currentAccessType == EAccessType.Enabled && Application.isPlaying)
|
|
currentAccessType = EAccessType.ReadOnly;
|
|
|
|
return currentAccessType;
|
|
}
|
|
}
|
|
} |