Editor GUILayout.ScrollView not scrolling when typing

I am having a rather frustrating time with ScrollViews.
Here’s a snippet from my custom editor that should be enough to reproduce the problem.

 EditorGUILayout.BeginVertical();
scrollPosition = GUILayout.BeginScrollView (scrollPosition);
_target.text = EditorGUILayout.TextArea(_target.text, style);
GUILayout.EndScrollView ();
EditorGUILayout.EndVertical ();

The problem is that when I give a few carriages so that the scroll bars appear, the scrolling does not follow the typing and I cannot see what I type.

Any ideas?

Hi @Rs. That’s super annoying! Would you mind filing a bug report please? In the meantime you can do something like this (though it’s a little naive):

EditorGUILayout.BeginVertical();
scrollPosition = EditorGUILayout.BeginScrollView (scrollPosition);
EditorGUI.BeginChangeCheck ();
string newText = EditorGUILayout.TextArea(_target.text);
if (EditorGUI.EndChangeCheck ())
{
	if (newText.StartsWith (_target.text))
		scrollPosition.y = Mathf.Infinity;
	_target.text = newText;
}
EditorGUILayout.EndScrollView ();
EditorGUILayout.LabelField (scrollPosition.ToString ());
EditorGUILayout.EndVertical ();