本文整理汇总了C#中PackageInfo.GetBundlePath方法的典型用法代码示例。如果您正苦于以下问题:C# PackageInfo.GetBundlePath方法的具体用法?C# PackageInfo.GetBundlePath怎么用?C# PackageInfo.GetBundlePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageInfo
的用法示例。
在下文中一共展示了PackageInfo.GetBundlePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildPackage
/// <summary>
/// 导出一个指定的包
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
static bool BuildPackage(PackageInfo info, BuildTarget buildTarget)
{
//打包package下的所有资源
UnityEngine.Object[] arrAssetObject = new UnityEngine.Object[info.packageAssets.Length];
string[] arrAssetNameInPackage = new string[info.packageAssets.Length];
for (int i = 0; i < info.packageAssets.Length; ++i)
{
string assetPath = info.packageAssets[i];
arrAssetObject[i] = AssetDatabase.LoadMainAssetAtPath(assetPath);
arrAssetNameInPackage[i] = GetAssetNameInPackage(assetPath).ToLower();//包中物体的名字,目前是相对与package目录的完整路径,以后可以修改
CheckAssetValid(assetPath, arrAssetObject[i]);
}
//这里使用CollectDependencies,但是由于外层使用了PushDependcies,所以依赖项可能是在其他的包中
string strOutputPath = info.GetBundlePath(buildTarget);// BuilderTools.GetOutputPath(buildTarget) + info.packageName + BUNDLE_EXT;
BuildPipeline.BuildAssetBundleExplicitAssetNames(arrAssetObject, arrAssetNameInPackage, strOutputPath
, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets | BuildAssetBundleOptions.DeterministicAssetBundle, buildTarget);
//生成信息文件
string strPackageInfoFilePath = info.GetInfoPath(buildTarget);// BuilderTools.GetOutputPath(buildTarget) + info.packageName + PACKAGE_INFO_EXT;
WritePackageInfoFile(strPackageInfoFilePath, info.ltDepPackages);
//生成版本信息文件,依赖项的信息要做为md5的一部分
string strVersionFilePath = info.GetVersionPath(buildTarget);
string strVersion = BuilderTools.GetVerifyString(new string[] { strPackageInfoFilePath }, new string[] { info.packagePath });
File.WriteAllText(strVersionFilePath, strVersion);
//写入统一的dat文件
string strDataFilePath = info.GetDataPath(buildTarget);// BuilderTools.GetOutputPath(buildTarget) + info.packageName + DATA_EXT;
CombineFinalPackage(strPackageInfoFilePath, strOutputPath, strDataFilePath);
Debug.Log("writed output file: " + strDataFilePath);
return true;
}