- Home /
Multiple GUILayoutOption for one GuiLayout.TextArea?
This fails:
var TextAreaLayoutOptions : UnityEngine.GUILayoutOption = GUILayout.Height(200) + GUILayout.ExpandHeight(false);
GUILayout.TextArea(someText, TextAreaLayoutOptions);
What is the concat operator for two GUILayoutOption?
Answer by andeeee · Feb 25, 2010 at 04:41 PM
There isn't a concat operator. You can either pass an array of GUILayoutOptions or pass several of them directly to the function. For example:-
GUILayout.TextArea(someText, GUILayout.Height(200), GUILayout.ExpandHeight(false));
Thanks a lot! It really should be explained in the docs. ^^
The docs say: static function TextArea (text : string, params options : GUILayoutOption[]) : string "GUILayoutOption[]"
So I tried:
var TextAreaLayoutOptions: GUILayoutOption[] = [GUILayout.Height(200),GUILayout.ExpandHeight(false)];
GUILayout.TextArea(someText, TextAreaLayoutOptions);
Fails.
And using this:
var TextAreaLayoutOptions : Array = new Array();
TextAreaLayoutOptions.Push(GUILayout.Height(200));
TextAreaLayoutOptions.Push(GUILayout.ExpandHeight(false));
GUILayout.TextArea(someText, TextAreaLayoutOptions);
Fails too.
So the documentation is wrong I think.
I really had to write:
GUILayout.TextArea(someText, GUILayout.Height(200), GUILayout.ExpandHeight(false));
Works
Can I place it into a var somehow? I'd like to place the options outside in a config.
Your answer
Follow this Question
Related Questions
TextField text pushed to left on space 1 Answer
For Loop GUILayout.Label Problems 1 Answer
GUILayoutUtilities.GetRect 1 Answer
Odd GUILayout Placement 0 Answers
Can I put Transform (gameObject) into GUILayout in javascript? 2 Answers