提交 b21f8b52 编写于 作者: 魔术师Dix's avatar 魔术师Dix

增加同时创建大批量文件的方法;

上级 51ac3761
......@@ -195,6 +195,44 @@ namespace Aster.AsterBinary
#endif
}
/// <summary>
/// 同时创建大批量文件;
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="objs"></param>
/// <param name="newPath"></param>
/// <returns></returns>
public static T[] CreateAssets<T>(T[] objs, string[] newPath) where T : Object
{
#if UNITY_EDITOR
if (objs == null)
return null;
int length = objs.Length;
T[] result = new T[length];
AssetDatabase.StartAssetEditing();
try
{
for (int i = 0; i < length; i++)
{
var obj = objs[i];
var path = newPath[i];
result[i] = CreateAsset(obj, path);
}
}
catch (System.Exception ex)
{
Logger.LogException(ex);
}
AssetDatabase.StopAssetEditing();
return result;
#else
return null;
#endif
}
public static void SaveAndRefresh()
{
#if UNITY_EDITOR
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册