- Home /
Question by
tsondhi2006 · Sep 14, 2018 at 06:35 AM ·
editorwindowcustom editor
How to create a textfield in custom window editor using a button?
Hi,
I have a button on my custom editor and wanted to add a text field just on top of button on button click. For Eg:
i currently have this:-
If the button is pressed, i want this:-
every time the button is pressed, one more input below input 1 should come.
How can I do that?
capture2.png
(5.9 kB)
capture.png
(4.0 kB)
Comment
Answer by BastianUrbach · Sep 14, 2018 at 11:25 AM
I guess you want to store the values in some kind of list then? Just draw a text field for each list entry and make the button add a list entry.
private List<string> list; ... for (int i = 0; i < list.Count; i++) { list[i] = GUILayout.TextField(list[i]); } if (GUILayout.Button("+")) { list.Add(""); }
Your answer
Follow this Question
Related Questions
Custom Editor not saving - atypical problem 1 Answer
Invert DrawLine direction in editor Window. 1 Answer
In search of a gradient editor tool.. 0 Answers
Different approach to loading XML data 1 Answer
Custom brush tool? 0 Answers