5 public static List<T> GetAssetsWithScript<T>(string path) where T:MonoBehaviour
6 {
7 T tmp;
8 string assetPath;
9 GameObject asset;
10 List<T> assetList = new List<T> ();
11 string[] guids = AssetDatabase.FindAssets ("t:Prefab", new string[] {path});
12 for (int i = 0; i < guids.Length; i++)
13 {
14 assetPath = AssetDatabase.GUIDToAssetPath (guids[i]);
15 asset = AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject)) as GameObject;
16 tmp = asset.GetComponent<T> ();
17 if (tmp != null)
18 {
19 assetList.Add (tmp);
20 }
21 }
22 return assetList;
23 }