- Home /
Assetbundle problem: it was not built with the right version
Hi ....
I'm trying to use assetbundle in Unity 5.5 , but I always get this error message .
"can't be loaded because it was not built with the right version or build target"
I use this code to create the assetbundle
BuildPipeline.BuildAssetBundles("Assets/AssetBundles/CreatedBundles/Android", BuildAssetBundleOptions.None, BuildTarget.Android);
In android device, I use this code for downloading and importing the object that called "MODEL" from the assetbundle.
void Start()
{
StartCoroutine(DownloadAndCache(URL));
}
IEnumerator DownloadAndCache (string Path)
{
using (WWW www = WWW.LoadFromCacheOrDownload(Path, 0))
{
yield return www;
AssetBundle loadedAssetBundle = www.assetBundle;
//AssetBundleRequest request = loadedAssetBundle.LoadAssetAsync(ObjectNameToLoad, typeof(GameObject));
//GameObject gameObject = Instantiate(request.asset) as GameObject;
GameObject gameObject = GameObject.Instantiate(loadedAssetBundle.LoadAsset(ObjectNameToLoad) as GameObject);
Model = gameObject.transform;
Model.parent = transform;
Model.position = new Vector3(0, -2.0f, 0);
Model.localScale = new Vector3(2.5f, 2.5f, 2.5f);
Model.localEulerAngles = new Vector3(0, 180, 0);
loadedAssetBundle.Unload(false);
}
}
Where's the problem ?
Notes :
in Editor working fine
in old versions of unity, this code was working fine.
Thank you ...
Your answer
Follow this Question
Related Questions
AssetBundles - depend on asset already included in executable 0 Answers
AssetBundle - Broken link between Scene and Assets 0 Answers
Loading different bundles give me a null exception 0 Answers
Exception when building asset bundle with variant using build map 0 Answers
Addressable Assets Cache 0 Answers