Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using BracerLib.Data;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace BracerLib.Editor.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Referenced via: https://discussions.unity.com/t/select-only-one-layer-in-the-inspector-select-only-one-layer-in-the-inspector/230727
|
||||
/// </summary>
|
||||
[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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b603be9d2db54a6ba8f16f73927f322c
|
||||
timeCreated: 1773804726
|
||||
Reference in New Issue
Block a user