public static Object[] GetDirectoryAssets(string path)
{
List<Object> assets = new List<Object>();
// Get the file paths of all the files in the specified directory
string[] assetPaths = System.IO.Directory.GetFiles(path);
// Enumerate through the list of files loading the assets they represent
foreach (string assetPath in assetPaths)
{
// Check if it's a meta file
if (assetPath.Contains(".meta"))
continue;
Object objAsset = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object));
if (objAsset != null)
assets.Add(objAsset);
}
// Return the array of objects
return assets.ToArray();
}