【发布时间】:2018-03-24 18:27:57
【问题描述】:
我正在尝试从文件加载 AssetBundle,但出现以下错误:
The AssetBundle 'path\to\file' could not be loaded because it is not compatible with this newer version of the Unity runtime. Rebuild the AssetBundle to fix this error.
我按照 Unity wiki 所示构建我的 AssetBundle:
using UnityEditor;
namespace Editor
{
public class CreateAssetBundles
{
[MenuItem("Assets/Build AssetBundles")]
private static void BuildAllAssetBundles()
{
BuildPipeline.BuildAssetBundles("Assets/AssetBundles",
BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
}
}
}
这会生成一个外观正确的 AssetBundle,清单文件看起来也很好。
我使用以下代码加载 AssetBundle:
var assetBundle = AssetBundle.LoadFromFile(path);
AssetBundle 和游戏均使用相同版本的 Unity 构建,版本 2017.3.1f1(64 位)。我也尝试使用最新的可用 beta 版本构建这两个版本,但这并没有解决问题。
将 BuildTarget 更改为 BuildTarget.StandaloneWindows64 也不能解决问题。
【问题讨论】:
标签: c# unity3d assetbundle