using UnityEngine; using System.Collections.Generic; using UnityEditor; public class TryFindEditor : EditorWindow { // Add menu item named "My Window" to the Window menu [MenuItem("Window/Find All Type")] public static void ShowWindow() { //Show existing window instance. If one doesn't exist, make one. EditorWindow.GetWindow(typeof(TryFindEditor)); } List void OnGUI() { if (GUILayout.Button("Load")) { allMaterials = new List string[] paths = AssetDatabase.GetAllAssetPaths(); foreach (string path in paths) { Material mat = (Material)AssetDatabase.LoadAssetAtPath(path, typeof(Material)); if (mat != null) { Debug.Log(mat.name); allMaterials.Add(mat); } } Debug.Log(allMaterials.Count); } } } |
|