How to get spacing between inspector property labels and fields?
2020.3.11f1
From a PropertyDrawer, how do I get the horizontal spacing between property labels and fields in the inspector?
Image: https://forum.unity.com/attachments/upload_2021-6-13_20-32-40-png.870944/
[preview removed for GDPR compliance to avoid including cookies]
The controls in the above image were drawn with:
public override void OnGUI (Rect pos, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(pos, label, property);
EditorGUI.DrawRect(new Rect(pos.x, pos.y, EditorGUIUtility.labelWidth, EditorGUIUtility.singleLineHeight), Color.blue);
EditorGUI.TextField(pos, new GUIContent(" "), "");
EditorGUI.EndProperty();
}
Thanks.
Comment
Your answer
Follow this Question
Related Questions
How to create a selection menu in the inspector for classes and their methods? 1 Answer
help to fix bug with using GUIUtility.RotateAroundPivot + GUI.DrawTexture 1 Answer
GUILayout.Label with Texture2D on the same line in Inspector ? 1 Answer
GUI.Window. Wanting to allow clickthrough 0 Answers
Custom inspector KeyCode Selector 0 Answers