public static T[] GetAllInstance<T>() where T : ScriptableObject
{
string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).Name);
T[] resultArray = new T[guids.Length];
for (int i = 0; i < guids.Length; i++)
{
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
resultArray[i] = (T)AssetDatabase.LoadAssetAtPath(path, typeof(T));
}
return resultArray;
}
Unity 查找资源中所有相同的ScriptableObject资源
于 2024-10-11 12:45:15 首次发布