hellbound/Assets/Sources/Feel/MMTools/Editor/MMUtilities/MMLayerPropertyDrawer.cs

25 lines
834 B
C#
Raw Permalink Normal View History

2021-11-26 11:16:25 +03:00
using UnityEditor;
using UnityEngine;
namespace MoreMountains.Tools
{
[CustomPropertyDrawer(typeof(MMLayer))]
public class MMLayerPropertyDrawer : PropertyDrawer
{
#if UNITY_EDITOR
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, GUIContent.none, property);
SerializedProperty layerIndex = property.FindPropertyRelative("_layerIndex");
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
if (layerIndex != null)
{
layerIndex.intValue = EditorGUI.LayerField(position, layerIndex.intValue);
}
EditorGUI.EndProperty();
}
#endif
}
}