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