19 public static class EditorResources {
25 public static T[] FindAllAssetsOfType<T>() where T :
Object {
26 return AssetDatabase.FindAssets(
"t:" + typeof(T).Name).
27 Select(guid => AssetDatabase.GUIDToAssetPath(guid)).
28 Select(path => AssetDatabase.LoadAssetAtPath<T>(path)).
37 public static T Load<T>(
string name) where T :
Object {
38 foreach (var rootDir
in Directory.GetDirectories(
"Assets",
"EditorResources", SearchOption.AllDirectories)) {
39 string fullPath = Path.Combine(rootDir, name +
".dummy");
40 string fullDir = Path.GetDirectoryName(fullPath);
41 string fileName = Path.GetFileNameWithoutExtension(fullPath);
47 foreach (var filename
in Directory.GetFiles(fullDir, fileName +
".*")) {
48 if (!
string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(filename))) {
49 return AssetDatabase.LoadAssetAtPath<T>(filename);