The vertical scroll doesn’t show for this code, no matter how much text I fill in.
GUILayout.BeginArea(new Rect(40, 90, 230, 210));
scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(230), GUILayout.Height(210));
GUI.TextArea(new Rect(0, 0, 230, 210), strCombatWrap);
GUILayout.EndScrollView();
GUILayout.EndArea();
I have almost the identical code working in another window with a selection grid, only difference is no height set for the selection grid.
Is there something I am missing here?
Thanks for any info.
I found the answer.
For anyone looking for this answer my change needs to be:
GUILayout.BeginArea(new Rect(40, 90, 230, 210));
scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(230), GUILayout.Height(210));
GUI.TextArea(new Rect(0, 0, 230, 210), strCombatWrap);
GUILayout.EndScrollView();
GUILayout.EndArea();
To Become:
GUILayout.BeginArea(new Rect(40, 90, 230, 210));
scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(230), GUILayout.Height(210));
strCombatWrap = GUILayout.TextArea(strCombatWrap);
GUILayout.EndScrollView();
GUILayout.EndArea();
If you want it to auto scroll to bottom then whatever method you have updating your text area you need:
scrollPosition = new Vector2(scrollPosition.x, Mathf.Infinity);