纳金网
标题:
新版资源单个循环打包,修改资源名添加拓展名
[打印本页]
作者:
may
时间:
2018-7-22 01:31
标题:
新版资源单个循环打包,修改资源名添加拓展名
[MenuItem("Framework/SetABNameExtenAndBulidResource")]
static void SetBundleNameBuilResource()
{
Object[] selects = Selection.objects;
AssetBundleBuild[] buildMap = new AssetBundleBuild[selects.Length];
string[] paths = new string[selects.Length];
for(int i = 0;i < selects.Length; i++)
{
//AssetBundleBuild[] buildMap = new AssetBundleBuild[2];
paths[i] = AssetDatabase.GetAssetPath(selects[i]);
AssetImporter asset = AssetImporter.GetAtPath(paths[i]);
asset.assetBundleName = selects[i].name;
asset.assetBundleVariant = "<a target="_blank" class="relatedlink">unity3d</a>";
buildMap[i].assetBundleName = selects[i].name;
buildMap[i].assetBundleVariant = "unity3d";
string[] enemyAssets = new string[1];
enemyAssets[0] = paths[i];
buildMap[i].assetNames = enemyAssets;
}
BuildPipeline.BuildAssetBundles("Assets/ABs",buildMap, BuildAssetBundleOptions.None,BuildTarget.WebGL);
AssetDatabase.Refresh();
}
复制代码
来自:
仅为年时
欢迎光临 纳金网 (http://rs.narkii.com/club/)
Powered by Discuz! X2.5