1.8.4: Added PopupFromScriptableObjectType

This commit is contained in:
Anders Ejlersen 2023-12-09 22:38:27 +01:00
parent 3259b62387
commit 81906d49dd
12 changed files with 202 additions and 1 deletions

View file

@ -0,0 +1,30 @@
using UnityEditor;
namespace Module.Inspector.Editor.AssetImporters
{
internal sealed class EditorAssetImporterForScriptableObject : AssetPostprocessor
{
public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
if (HasAnyScriptableObjects(importedAssets) ||
HasAnyScriptableObjects(deletedAssets) ||
HasAnyScriptableObjects(movedAssets))
{
EditorUtilitySearchObject.Clear();
}
}
private static bool HasAnyScriptableObjects(string[] paths)
{
for (var i = 0; i < paths.Length; i++)
{
string path = paths[i];
if (path.EndsWith(".asset"))
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a1d618b9d79641b79e5815e258baeecb
timeCreated: 1702156766