Mimic look of EditorGUILayout.BoundsField

I’m working on a custom editor window and I have a Bounds and a Vector3. If I use the BoundsField and Vector3Field for the values, they don’t line up nicely at all. So what I’m trying to do is create my own UI that will mimic the bounds field (one row of it, anyway) for my three float values. However I can’t seem to figure out the magic thing to get the UI to match it. Here’s what I have so far:

GUILayout.Label("Cube Settings");
bounds = EditorGUILayout.BoundsField(bounds);

GUILayout.BeginHorizontal();
GUILayout.Label("   UV:");
uvTiling.x = EditorGUILayout.FloatField("X", uvTiling.x);
uvTiling.y = EditorGUILayout.FloatField("Y", uvTiling.y);
uvTiling.z = EditorGUILayout.FloatField("Z", uvTiling.z);
GUILayout.EndHorizontal();

But that doesn’t end up looking right at all. I’m pretty sure I’m going to need to use some of the styling options, but I was hoping: has anyone already done the work of figuring out how to match this UI to save me some time? Any pointers?

Try to use GUILayout.Height to set the height of a value. But if you still have problems, the code for BoundsField is this:

// UnityEditor.EditorGUI
public static Bounds BoundsField(Rect position, Bounds value)
{
	position = EditorGUI.DrawBoundsFieldLabelsAndAdjustPositionForValues(position);
	value.center = EditorGUI.Vector3Field(position, value.center);
	position.y += 16f;
	value.extents = EditorGUI.Vector3Field(position, value.extents);
	return value;
}

private static Rect DrawBoundsFieldLabelsAndAdjustPositionForValues(Rect position)
{
	GUI.Label(EditorGUI.IndentedRect(position), "Center:", EditorStyles.label);
	position.y += 16f;
	GUI.Label(EditorGUI.IndentedRect(position), "Extents:", EditorStyles.label);
	position.y -= 16f;
	position.x += 50f;
	position.width -= 50f;
	return position;
}

Try to use ILSpy to figure out how they do things.