Skip to content

Commit 0b4833a

Browse files
committed
focus on project window option added
1 parent b958e1d commit 0b4833a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Assets/Editor/Editor Windows/ScriptableObjectEditorWindow.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ private void ShowOptionsMenu<T>(T Config) where T : ScriptableObject
512512
GenericMenu menu = new GenericMenu();
513513

514514
menu.AddItem(new GUIContent("Delete Config"), false, () => DeleteConfig(Config));
515+
menu.AddSeparator("");
516+
menu.AddItem(new GUIContent("Show In Project Folder"), false, () => ShowInProjectFolders(Config));
515517

516518
menu.ShowAsContext();
517519
}
@@ -568,13 +570,13 @@ private void PutPropertiesForObject_H<T>(List<T> Configs) where T : ScriptableOb
568570
string fileName = System.IO.Path.GetFileNameWithoutExtension(filePath);
569571
if (fileName == "") throw new System.Exception();
570572

571-
// Display a delete button for the asset
572-
DeleteButton(Config);
573-
574573
// Display the file name for the asset
575574
GUIContent propertyContent = new GUIContent(fileName, fileName);
576575
EditorGUILayout.LabelField(propertyContent, EditorStyles.miniBoldLabel, GUILayout.Width(120));
577576

577+
// Display a delete button for the asset
578+
OptionsButton(Config);
579+
578580
SerializedObject serializedObject = new(Config);
579581
SerializedProperty property = serializedObject.GetIterator();
580582

@@ -621,6 +623,13 @@ private void DeleteConfig<T>(T Config) where T : ScriptableObject
621623
}
622624
}
623625

626+
private void ShowInProjectFolders<T>(T Config) where T : ScriptableObject
627+
{
628+
string path = AssetDatabase.GetAssetPath(Config);
629+
EditorUtility.FocusProjectWindow();
630+
Selection.activeObject = AssetDatabase.LoadAssetAtPath<ScriptableObject>(path);
631+
}
632+
624633
public static float CalculatePropertyHeight<T>(List<T> configs, SerializedProperty property) where T : ScriptableObject
625634
{
626635
float maxHeight = 0f;

0 commit comments

Comments
 (0)