Custom Inspector

Hello everyone,
im trying to create a custom editor. But im stuck on 1 thing. I have managed to get everything working, except i wanna show my int fields like it does in Rect Transform. Liek the one i have as an attachment. Thanks in advance.

2898906--213366--Capture.PNG

Have you tried using editor extensions from the Unity Asset Store?

@CanAydin , what are you stuck at? Getting them to line up horizontally? Getting them to be that close to each other? Having the label over the field?

@Baste Having the “pos X” on top and then the int field under it. So having the label over the field yes.
@ No i havent but i want to create it on my own, don’t want to use any extensions

To make those things line up nicely, the most reliable way is to use the rect-based GUILayout stuff. You can reserve Rects with GetControlRect, and then use parts of that rect for whatever you’re drawing. Then you can specify exactly the coordinates of everything.

A faster and easier way is to just combine Horizontal groups with explicit widths:

EditorGUILayout.BeginHorizontal();
EditorGUILayout.Label("X Thingy", GUILayout.Width(100f));
GUILayout.Space(20f);
EditorGUILayout.Label("Y Thingy", GUILayout.Width(100f));
EditorGUILayout.EndHorizontal();

EditorGUILayout.BeginHorizontal();
xThingy = EditorGUILayout.IntField(xThingy, GUILayout.Width(100f));
GUILayout.Space(20f);
yThingy = EditorGUILayout.IntField(yThingy, GUILayout.Width(100f));
EditorGUILayout.EndHorizontal();

@Baste Thank you very much, you have solved my problems.