refactor
This commit is contained in:
17
Editor/Utils/AssetDatabaseEx.cs
Normal file
17
Editor/Utils/AssetDatabaseEx.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKitEditor.Utils {
|
||||
public static class AssetDatabaseEx {
|
||||
public static T[] LoadAllAssets<T>() where T : Object {
|
||||
string[] guids = AssetDatabase.FindAssets($"t:{typeof(T).Name}");
|
||||
T[] assets = new T[guids.Length];
|
||||
for (int i = 0; i < guids.Length; i++) {
|
||||
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
||||
assets[i] = AssetDatabase.LoadAssetAtPath<T>(path);
|
||||
}
|
||||
|
||||
return assets;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Editor/Utils/AssetDatabaseEx.cs.meta
Normal file
3
Editor/Utils/AssetDatabaseEx.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59e4d03719034eccb354318815416f1c
|
||||
timeCreated: 1744660576
|
||||
Reference in New Issue
Block a user