目录结构:
获取Prefab下的所有prefab
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
public class Test
{
[MenuItem("BuildTool/Lugs")]
static void LugsTest()
{
string path = "Assets/UI/Prefab";
GetAllPrefabs(path);
}
static void GetAllPrefabs(string directory)
{
if (string.IsNullOrEmpty(directory) || !directory.StartsWith("Assets"))
throw new ArgumentException("folderPath");
string[] subFolders = Directory.GetDirectories(directory);
string[] guids = null;
string[] assetPaths = null;
int i = 0, iMax = 0;
foreach (var folder in subFolders)
{
guids = AssetDatabase.FindAssets("t:Prefab"