I have an object field custom inspector that shows a preview of the object sprite. I can not figure out how to align the preview to the left. It does not have a label, just a blank string, but If I remove that it does not show the preview at all. Inspector code is below
![public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
GridComponent = (DCCGrid)target;
serializedObject.Update();
EditorStyles.foldout.fontStyle = FontStyle.Bold;
ShowCellList = EditorGUILayout.Foldout(ShowCellList, "Cell List");
EditorStyles.foldout.fontStyle = standardEditorFontStyle;
if(ShowCellList)
{
EditorGUI.indentLevel = EditorGUI.indentLevel + 1;
ScrollPosition = EditorGUILayout.BeginScrollView(ScrollPosition, GUILayout.Height(200));
List<GameObject> cellObjectList = new List<GameObject>(GridComponent.CellObjectList);
foreach (GameObject cellObject in cellObjectList)
{
Transform buttonTransform = cellObject.transform.FindChild("Button Image");
Image buttonImage = buttonTransform.GetComponent<Image>();
GridComponent.Editor_IsFoldoutOpen = EditorGUILayout.Foldout(GridComponent.Editor_IsFoldoutOpen, cellObject.name);
if (GridComponent.Editor_IsFoldoutOpen)
{
//EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
buttonImage.sprite = (Sprite)EditorGUILayout.ObjectField("", buttonImage.sprite, typeof(Sprite), allowSceneObjects: false);
EditorGUILayout.EndHorizontal();
Button buttonScript = cellObject.GetComponent<Button>();
SerializedObject serializableButtonScript = new SerializedObject(buttonScript);
EditorGUILayout.BeginHorizontal();
SerializedProperty onClickEvent = serializableButtonScript.FindProperty("m_OnClick");
EditorGUILayout.PropertyField(onClickEvent, true);
EditorGUILayout.EndHorizontal();
}
}
EditorGUILayout.EndScrollView();
EditorGUI.indentLevel = EditorGUI.indentLevel - 1;
}
serializedObject.ApplyModifiedProperties();
EditorGUI.EndChangeCheck();
}
EditorGUI.EndChangeCheck();
}][1]