First commit for private source control. Older commits available on Github.

This commit is contained in:
2026-03-26 12:52:52 +00:00
parent a04c602626
commit 2d449c4a17
2176 changed files with 408185 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using UnityEngine;
using UnityEditor;
using System;
namespace NaughtyAttributes.Editor
{
[CustomPropertyDrawer(typeof(EnumFlagsAttribute))]
public class EnumFlagsPropertyDrawer : PropertyDrawerBase
{
protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label)
{
Enum targetEnum = PropertyUtility.GetTargetObjectOfProperty(property) as Enum;
return (targetEnum != null)
? GetPropertyHeight(property)
: GetPropertyHeight(property) + GetHelpBoxHeight();
}
protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(rect, label, property);
Enum targetEnum = PropertyUtility.GetTargetObjectOfProperty(property) as Enum;
if (targetEnum != null)
{
Enum enumNew = EditorGUI.EnumFlagsField(rect, label.text, targetEnum);
property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType());
}
else
{
string message = attribute.GetType().Name + " can be used only on enums";
DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning);
}
EditorGUI.EndProperty();
}
}
}