Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using UnityEngine;
using UnityEditor;
namespace Febucci.Attributes
{
[CustomPropertyDrawer(typeof(PositiveValueAttribute))]
public class PositiveValueAttributeDrawer : PropertyDrawer
{
const float minValue = .01f;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
switch (property.propertyType)
{
case SerializedPropertyType.Integer:
int intValue = property.intValue;
intValue = EditorGUI.IntField(position, label, intValue);
if (intValue >= minValue)
property.intValue = intValue;
break;
case SerializedPropertyType.Float:
float floatValue = property.floatValue;
floatValue = EditorGUI.FloatField(position, label, floatValue);
property.floatValue = Mathf.Clamp(floatValue, minValue, floatValue);
break;
case SerializedPropertyType.Vector2:
Vector2 vecValue = property.vector2Value;
vecValue = EditorGUI.Vector2Field(position, label, vecValue);
vecValue.x = Mathf.Clamp(vecValue.x, minValue, vecValue.x);
vecValue.y = Mathf.Clamp(vecValue.y, minValue, vecValue.y);
property.vector2Value = vecValue;
break;
default:
base.OnGUI(position, property, label);
break;
}
}
}
}