I’m using the counter variable for that in this line:
EditorGUILayout.ObjectField(counter.ToString(), item.GameObject, typeof(GameObject), true);
and I want to have more control on the space between the number/s on the left and the objects.
now there is a lot of space/gap between them.
here is a screenshot showing it:
i marked with red the space I mean that I want to control and, in this case, to reduce.
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();
}