2 Replies

I suppose you're using GUILayout methods inside the ScrollView. If so, you could a) calculate the width of the whole GUI area which includes the eventual scrollbar, then b) get the size of the first wide element you draw (using GUILayoutUtility.GetLastRect): if it's less then the whole area then the scrollabar is present, otherwise not.

The trick I use is based on EditorGUILayout (might work with GUILayout too). What it does is to use GetLastRect before and after calling EndScrollView and EndHorizontal or EndVertical and compare two values to see if the ScrollView is smaller.
It's a bit of a hack but it works for me. Make sure the calls to GetLastRect happen only when there's a Rapaint event like below.

After drawing some stuff, for example, in the OnGUI function, here we get the y value from the rect resulting from GetLastRect.