Make the scrollbar responsive

This is the code of my TextArea:

GUILayout.BeginArea(new Rect(5,110,300,105));

scrollpos = EditorGUILayout.BeginScrollView(scrollpos);
stringToEdit = EditorGUILayout.TextArea(stringToEdit, style);

EditorGUILayout.EndScrollView();
GUILayout.EndArea();

The scrollbar is not responsive at all to the text. Like for example if I type and go to another line the scroll bar wont go down. And if I want to go up it wont do that too. How to fix this and make it responsive?

EDIT: I missed that it was for an editor script.

They should probably not port it to the new UI system, as they’re writing editor code that goes in an editor window or inspector.

@DeadlyMissile , late response, but if that doesn’t happen automatically, it’s probably a bug. Are you saying that the scroll bar doesn’t react to the text’s size ever, or does it doesn’t react before you touch it?

It might have to do with the area. Does it work without that?