This commit is contained in:
2026-07-24 18:20:02 +09:00
commit 0b02bacb3d
177 changed files with 5172 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using UnityEditor;
using UnityEngine;
// IntRange를 "라벨 [Min] ~ [Max]" 한 줄로 그린다.
[CustomPropertyDrawer(typeof(IntRange))]
public class IntRangeDrawer : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
=> EditorGUIUtility.singleLineHeight;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
position = EditorGUI.PrefixLabel(position, label);
int indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0; // PrefixLabel 뒤 필드가 들여쓰기에 밀리지 않게
const float tildeWidth = 14f;
float fieldWidth = (position.width - tildeWidth) * 0.5f;
var minRect = new Rect(position.x, position.y, fieldWidth, position.height);
var tildeRect = new Rect(minRect.xMax, position.y, tildeWidth, position.height);
var maxRect = new Rect(tildeRect.xMax, position.y, fieldWidth, position.height);
EditorGUI.PropertyField(minRect, property.FindPropertyRelative("Min"), GUIContent.none);
EditorGUI.LabelField(tildeRect, "~", CenteredLabel);
EditorGUI.PropertyField(maxRect, property.FindPropertyRelative("Max"), GUIContent.none);
EditorGUI.indentLevel = indent;
EditorGUI.EndProperty();
}
static GUIStyle _centered;
static GUIStyle CenteredLabel => _centered ??= new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleCenter };
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 878034b1fe8afe64eaeb9b2e9b329778