using BracerLib.Data; using UnityEditor; using UnityEngine; using UnityEngine.TestTools; namespace BracerLib.Editor.Data { /// /// Referenced via: https://discussions.unity.com/t/select-only-one-layer-in-the-inspector-select-only-one-layer-in-the-inspector/230727 /// [CustomPropertyDrawer(typeof(Layer))] [ExcludeFromCoverage] public class LayerPropertyDrawer : PropertyDrawer { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, GUIContent.none, property); var 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(); } } }