private static void AddObjectSelectionToggle <T>(T targetObject) where T : Object { EditorGUI.BeginChangeCheck(); GUILayoutOption[] guiLayoutOptions = { GUILayout.ExpandWidth(false), GUILayout.Width(15) }; bool isObjectsSelected = EditorGUILayout.Toggle(SpriteAuditorUtility.IsObjectSelected(targetObject), EditorStyles.toggle, guiLayoutOptions); if (EditorGUI.EndChangeCheck()) { SpriteAuditorUtility.SetObjectSelected(targetObject, isObjectsSelected); } }