How do I add a scrolling input text box in an EditorWindow?
I’ve been searching for a while, trying to figure out how to make a scrolling text input box for my Unity Addon I’m building. I’ve had 0 success in finding a solution that works.
In essence, I need to add a scrolling editable text area to my editorwindow to allow the user to input data of unknown length.
I’ve tried the following, and no luck.
Vector2 ScrollPos;
String ParseData = "";
ScrollPos = EditorGUILayout.BeginScrollView(ScrollPos,GUILayout.Height(100));
EditorGUILayout.TextArea(ParseData,GUILayout.Height(200));
EditorGUILayout.EndScrollView();
This is the structure of the code I’ve been seeing everywhere; however, it only encases the textarea with a scroll bar, and doesn’t add it to the textarea itself. If the TextArea is larger than the scroll height, it can scroll the TextArea; however, it has no effect on the text inside the TextArea. As I add lines of text into the TextArea, when the text passes the end of the TextArea, there is no way to scroll the text up or down to see the rest.
Example Images:
This first images shows text loaded into the TextArea and the scroll bar already aligned at the bottom.
When I add a few lines into the TextArea, the text simply gets pushed off the edge of the TextArea, and the scrollbar does nothing to compensate for this. I’ve determined that the ScrollView is only encompassing the TextArea, and not working with the TextArea.
I need the scrollbar to be able to scroll the TextArea to allow the user to scroll up and down through the text he writes into the TextArea.
Am I doing it wrong, is there supposed to be a different way to do this?
Note to Mods: My original question was rejected due to lack of information; however, after adding more information, I couldn’t figure out how to resubmit the question, so I caved and created a new question.