最近在参与AssetBundle划分策略的讨论,关于AssetBundle的细分方面,记得上个项目的时候主程说过,IOS有一个限制文件句柄的问题,还有5.3之前Android的SerializeFile每一个都是512K,不过这些问题在新的版本中都已经解决,但是是否bundle越大越好,或者是越细碎越好呢?简单做了一个测试,将大概80个图片单打成一个bundle大概1M以及打成80个不同的bundle,为求结果的准确性,测试2000次:
测试代码如下:
if (GUI.Button(new Rect(100, 200, 100, 50), "LoadOneByOne"))
{
string[] tempArr = bbb.Split(',');
float totalTime = 0;
Dictionary<string, AssetBundle> tempDic = new Dictionary<string, AssetBundle>();
for (int i = 0; i < 2000; i++)
{
for (int j = 0; j < tempArr.Length; j++)
{
float t = Time.realtimeSinceStartup;
AssetBundle assetBundle = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/" + tem