- Home /
How to allocate layout region inside the inspector?
How to allocate layout region inside the inspector, if i want to draw custom stuff to this layout region for example :
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Field1");
var areaRect = GUILayoutUtility.GetLastRect();
areaRect.y += areaRect.height;
areaRect.width = EditorGUIUtility.currentViewWidth;
areaRect.height = 100.0f;
// draw something in areaRect
EditorGUILayout.LabelField("Field3");
EditorGUILayout.EndVertical();
The "Field3" of my example is drawn over my custom region... Maybe they is a way to increase current inspector position?
Comment
Answer by sdalex · Apr 17, 2018 at 02:08 PM
Answering my own question:
// To allocate space vertically
EditorGUILayout.BeginVertical();
...
EditorGUILayout.Space(size);
...
EditorGUILayout.EndVertical();
// To allocate space horizontally
EditorGUILayout.BeginHorizontal();
...
EditorGUILayout.Space(size);
...
EditorGUILayout.EndHorizontal();
Or
GUILayoutUtility.GetRect(new GUIContent(""), GUIStyle.none, GUILayout.Width(width), GUILayout.Height(height));
Your answer
Follow this Question
Related Questions
How do I access the "Edit Collider" function from the inspector in a custom editor. 1 Answer
How to set minimum height for EditorGUILayout scroll view? 1 Answer
How can i get SerializedProperty from UnityEvent which in List. Sorry for my Eng. 2 Answers
Inspector look changed 0 Answers
Custom editor super slow even with no draw operations 1 Answer