AB包所处的环境不同
public static IEnumerator GetAssetBundle(string path,Action<AssetBundle> callback)
{
StringBuilder filepath = new StringBuilder();
filepath.Append(Application.dataPath);
filepath.Append(path);
AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(File.ReadAllBytes(filepath.ToString()));
yield return request;
callback(request.assetBundle);
}
string path = @"/AssetBundles/123.text";
Action<AssetBundle> callback=delegate(AssetBundle ab)
{
};
StartCoroutine(GetAssetBundle(path, callback));
Application.dataPath 所处的环境为Project_Data,将AB包文件夹放到里面就OK