Skip to content

Commit 21b3de4

Browse files
committed
start optimizations added
1 parent 7835dbc commit 21b3de4

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

Assets/Editor/Editor Windows/ScriptableObjectEditorWindow.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,32 @@ private void OnGUI()
156156

157157
EditorGUILayout.Space(5);
158158

159+
if(selectedTypes == null || selectedTypes.Count == 0 || groupedConfigs == null || groupedConfigs.Count == 0)
160+
{
161+
EditorGUILayout.LabelField("Select a config from filters", EditorStyles.boldLabel);
162+
return;
163+
}
164+
165+
166+
// create config button styles:
167+
GUIContent AddConfigButton;
168+
GUILayoutOption[] AddConfigButtonOptions;
169+
GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
170+
if (addConfigIcon != null)
171+
{
172+
AddConfigButton = new GUIContent(addConfigIcon, "create new config");
173+
AddConfigButtonOptions = new GUILayoutOption[] { GUILayout.Height(20), GUILayout.Width(20) };
174+
175+
buttonStyle.padding = new RectOffset(2, 2, 2, 2);
176+
buttonStyle.imagePosition = ImagePosition.ImageOnly;
177+
}
178+
else
179+
{
180+
AddConfigButton = new GUIContent("Add new", "create new config");
181+
AddConfigButtonOptions = new GUILayoutOption[] { GUILayout.Width(65) };
182+
}
183+
184+
159185
// show configs
160186
ScrollPosMain = EditorGUILayout.BeginScrollView(ScrollPosMain);
161187
if (groupedConfigs.Count != 0)
@@ -169,28 +195,8 @@ private void OnGUI()
169195
GUILayout.Space(20);
170196

171197
EditorGUILayout.BeginHorizontal();
172-
173-
GUIContent AddConfigButton;
174-
GUILayoutOption[] AddConfigButtonOptions;
175-
GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
176-
177-
if (addConfigIcon != null)
178-
{
179-
AddConfigButton = new GUIContent(addConfigIcon, "create new config from " + configGroup[0].GetType().Name);
180-
AddConfigButtonOptions = new GUILayoutOption[] { GUILayout.Height(20), GUILayout.Width(20) };
181-
182-
// Ýkon için padding'i azalt
183-
buttonStyle.padding = new RectOffset(2, 2, 2, 2);
184-
// Ýkonun buton içindeki boyutunu ayarla
185-
buttonStyle.imagePosition = ImagePosition.ImageOnly;
186-
}
187-
else
188-
{
189-
AddConfigButton = new GUIContent("Add new", "create new config from " + configGroup[0].GetType().Name);
190-
AddConfigButtonOptions = new GUILayoutOption[] { GUILayout.Width(65) };
191-
}
192198

193-
// Buton çaðrýsýnda GUIStyle parametresini ekleyin
199+
// create config button:
194200
if (GUILayout.Button(AddConfigButton, buttonStyle, AddConfigButtonOptions))
195201
{
196202
AddNewSO(configGroup[0].GetType());
@@ -327,12 +333,6 @@ private void LoadAvailableTypes()
327333
selectedTypes.Add(type);
328334
}
329335
}
330-
331-
if (selectedTypes.Count == 0)
332-
{
333-
Debug.LogWarning("no saved filter found for Game Config Editor.");
334-
selectedTypes.AddRange(availableTypes);
335-
}
336336
}
337337

338338
private void GroupScriptableObjectsByType()

0 commit comments

Comments
 (0)