最近一个项目要用到批量的设置AB包名,由于同一类的资源在一个文件夹内,所以就查着资料写了一个小工具,以文件夹为单位批量修改内部的资源包名,方便打包,话不多说直接上代码吧:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
public class SetAssetBundleName : EditorWindow
{
//******系统设置
//一种系统样式,使用他可以使控件周围表现为一个BOX的模样
private GUIStyle _box = new GUIStyle("Box");
//******窗口参数
private Vector2 _FilesScrollValue;//当前文件滚动的位置
//******资源参数
static List<stru_FileInfo> list_Files;//文件列表
string assetBundleName;
string assetBundleVariant = "";
//int indentation;//缩进等级
struct stru_FileInfo
{
public string fileName;
public string filePath;//绝对路径
public string assetPath;//U3D内部路径
public Type assetType;
}
[MenuItem("Assets/AssetBundle工具箱/设置AB包名")]
private static void OpenSetAssetBundleNameWindow()
{
list_Files = new List<stru_FileInfo>();
//indentation = 1;
CheckFileSystemInfo();
SetAssetBundleName ABNameWin = GetWindow<SetAssetBundleName>("设置AssetBundlesName");
ABNameWin.position = new Rect(300, 100, 300,500);
ABNameWin.minSize = new Vector2(300, 500);
ABNameWin.Show();
}
pri