using UnityEditor; using UnityEngine; namespace Ubisoft.Hotel.Logger.Editor { [CustomPropertyDrawer(typeof(ChannelsPreset.ChannelSettings))] public class ChannelSettingDrawer : PropertyDrawer { // Draw the property inside the given rect public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { _ = EditorGUI.BeginProperty(position, label, property); // Don't make child fields be indented var indent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; // Calculate rects var enabledRect = new Rect(position.x, position.y, 10, position.height); var nameRect = new Rect(position.x + 20, position.y, position.width - 20, position.height); // Draw fields - passs GUIContent.none to each so they are drawn without labels _ = EditorGUI.PropertyField(enabledRect, property.FindPropertyRelative(ChannelsPreset.ChannelSettings.ATT_ENABLED), GUIContent.none); _ = EditorGUI.PropertyField(nameRect, property.FindPropertyRelative(ChannelsPreset.ChannelSettings.ATT_NAME), GUIContent.none); // Set indent back to what it was EditorGUI.indentLevel = indent; EditorGUI.EndProperty(); } } }