- Home /
Adjust the width/height of List property elements in the Inspector
I would like to do change the height of the element properties showing in the Inspector from this to something like this I made up the image to show you what I want to achieve. The list is just public List< string> , and i want to enter separate strings (paragraphs) to each of the elements in the List so i can use it elsewhere. The thing is in the first image, for long texts, it doesn't show all the text i typed. I assume it has something to do with EditorGUI or CustomPropertyDrawer at first but failed to find any further clue
Answer by Vivien_Lynn · Aug 20, 2021 at 03:40 PM
You can add an Text Area Attribute to your list of strings, like so:
[TextArea(4, 8)]
[SerializeField] private List<string> strings;
The overloads define the size of the text area. In my example it always shows at leas 4 lines of text, and will add a scrollbar, once you have more than 8 lines of text.
Edit: I notice that it is not accurate how Unity displays the amount of lines in the inspector. But I assume this will still work for you the way you want it.
Your answer
Follow this Question
Related Questions
How do I get the default scene GUI for a CustomEditor for RectTransform? 1 Answer
How do you get the height dimension of the asset label box in the game inspector 0 Answers
Find out default inspector height 1 Answer
Text in custom editor is displayed/rendered with boxes around characters... 2 Answers
Dynamic Editor Window Layout 0 Answers