Skip to content

Instantly share code, notes, and snippets.

@sebtoun
Last active August 3, 2023 09:15
Show Gist options
  • Save sebtoun/d7df89e9cbb56878ac3fcca59b78e560 to your computer and use it in GitHub Desktop.
Save sebtoun/d7df89e9cbb56878ac3fcca59b78e560 to your computer and use it in GitHub Desktop.
using UnityEngine;
/// <summary>
/// Attribute to select a single layer.
/// </summary>
public class LayerAttribute : PropertyAttribute
{
}
using UnityEditor;
using UnityEngine;
[ CustomPropertyDrawer( typeof( LayerAttribute ) ) ]
public class LayerAttributeDrawer : PropertyDrawer
{
public override void OnGUI( Rect position, SerializedProperty property, GUIContent label )
{
property.intValue = EditorGUI.LayerField( position, label, property.intValue );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment