- Home /
Question by
Siljias · Jun 03, 2020 at 09:41 AM ·
unityeditoreditorguieditorguilayout
Wrap a group of EditorGUI.TextField, inside a Rect
I would like to loop through a collection of strings, and output an EditorGUI.TextField for each one.
However, I would like them to start wrapping onto a new line, once they reach the edge of their containing Rect.
Is there a more elegant solution to this, maybe through using GUIStyles and/or layout groups? Or will I have to control for this behavior manually.
Comment
I am taking a look at GUISkins, and am reviewing the I$$anonymous$$GUI part of the manual. I may find some layout tips in there.
Best Answer
Answer by Siljias · Jun 26, 2020 at 05:47 AM
I wound up using a 'SelectionGrid'
public class CM_ActiveSelectionChildren : DisplayUI
{
public SelectionChildrenNames SelectionChildrenNames; //This encapsulates an array of strings
int newSelectionInt;
public override void Display()
{
GUILayout.BeginArea(UIRect); //UIRect comes from the base class
newSelectionInt = GUILayout.SelectionGrid(newSelectionInt,
SelectionChildrenNames.names, 5);
GUILayout.EndArea();
}
}