I am writing a number of messages to a fixed area (a console) which I wish to be able to scroll up and down to view the message history.
// Console color
GUI.color = new Color(1f, 1f, 1f, 0.5f * consoleAlpha);
GUILayout.BeginArea(consoleRect, consoleStyle);
consoleViewPoint = GUILayout.BeginScrollView(consoleViewPoint, false, true);
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
// Message color
GUI.color = new Color(1f, 1f, 1f, 1f * consoleAlpha);
// Messages
foreach (var message in messages)
{
GUILayout.Label(message.Key + " " + message.Value, consoleMessageStyle);
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.EndArea();
With this setup the messages fill the fixed area correctly but the scroll view does not allow me to scroll inside the fixed area to view its content.
Where am I going wrong?