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

23 lines
791 B
C#
Raw Normal View History

2021-12-29 20:50:11 +03:00
using UnityEditor;
using UnityEngine;
namespace MoreMountains.Tools
{
[CustomPropertyDrawer(typeof(MMLayer))]
public class MMLayerPropertyDrawer : PropertyDrawer
{
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();
}
}
}