Added lots of examples for editor customization

This commit is contained in:
2026-06-23 18:33:11 +02:00
parent bbb7062c5b
commit 0512201ce0
58 changed files with 920 additions and 116 deletions
@@ -0,0 +1,30 @@
using UnityEditor;
using UnityEngine;
namespace Data.Editor
{
[CustomPropertyDrawer(typeof(CharacterAttributes))]
public class CharacterAttributesDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
bool isNull = property.objectReferenceValue == null;
position = EditorGUI.PrefixLabel(position, label);
if (!isNull) position.width *= 0.75f;
EditorGUI.PropertyField(position, property, GUIContent.none);
if (isNull) return;
position.x += position.width;
position.width *= 0.3333333f;
if (GUI.Button(position, "Open"))
{
CharacterAttributesWindow window = EditorWindow.GetWindow<CharacterAttributesWindow>();
window.CharacterAttributesToEdit = property.objectReferenceValue as CharacterAttributes;
window.Show();
}
}
}
}