string searchString;
void OnGUI()
{
int counter = 0;
GUI.color = Color.white;
GUILayout.Space(30);
GUILayout.FlexibleSpace();
searchString = GUILayout.TextField(searchString, GUI.skin.FindStyle("ToolbarSeachTextField"));
if (GUILayout.Button("", GUI.skin.FindStyle("ToolbarSeachCancelButton")))
{
searchString = "";
GUI.FocusControl(null);
}
GUILayout.Space(25);
scrollPos =
EditorGUILayout.BeginScrollView(scrollPos, false, true,
GUILayout.ExpandWidth(true), GUILayout.Height(position.height));
foreach (GameObjectAndScriptName item in gameObjectAndScriptNames)
{
EditorGUILayout.BeginHorizontal();
if (searchString != null)
{
if (item.ScriptName.Contains(searchString, StringComparison.CurrentCultureIgnoreCase))
{
EditorGUILayout.ObjectField(counter.ToString(), item.GameObject, typeof(GameObject), true);
counter++;
foreach (UnityEngine.Transform g in item.GameObject.transform.GetComponentsInChildren<UnityEngine.Transform>())
{
}
num.Add(EditorGUILayout.TextField(item.ScriptName).Length);
}
}
else
{
EditorGUILayout.ObjectField(counter.ToString(), item.GameObject, typeof(GameObject), true);
num.Add(EditorGUILayout.TextField(item.ScriptName).Length);
if (counter != gameObjectAndScriptNames.Count)
{
counter++;
}
}
EditorGUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
}
The result when I scroll down is there are still items below the bottom of the scroll range.
The farthest I can scroll down is to item 49, and I see half of item 50, but there are 55 items. Why is it not scrolling to the very bottom?