using Core; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; namespace Data { [CustomPropertyDrawer(typeof(CharacterAttributes))] public class CharacterAttributesDrawer : PropertyDrawer { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { position = EditorGUI.PrefixLabel(position, label); position.width *= 0.75f; EditorGUI.PropertyField(position, property, GUIContent.none); position.x += position.width; position.width *= 0.3333333f; if (GUI.Button(position, "Open")) { CharacterAttributesWindow window = EditorWindow.GetWindow(); window.CharacterAttributesToEdit = property.objectReferenceValue as CharacterAttributes; window.Show(); } } } }