```
DynamicDependenciesHolder holder = ScriptableObject.CreateInstance<DynamicDependenciesHolder>();
AssetDatabase.CreateAsset(holder, "Assets/test.asset"); //这个是相对路径,Assets目录下的文件
//AssetDatabase.CreateAsset(holder, Application.dataPath + "/test.asset"); 不能用绝对路径!!!
AssetBundleBuild buildInfo = new AssetBundleBuild();
buildInfo.assetBundleName = "bbb/test.x"; //这个是指在下面的test目录下的层级
buildInfo.assetNames = new string[] { "Assets/test.asset" }; //这个是相对路径
//test这个目录必须存在,否则返回ArgumentException: The output path "test/" doesn't exist
BuildPipeline.BuildAssetBundles("test/", new AssetBundleBuild[] { buildInfo }, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
EditorUtility.DisplayDialog("提示", Application.dataPath, "OK");
```
网友评论