Asset Bundle Can't be loaded because it was not built with the right version or build target

Hi,

I was building asset bundles using BuildTarget.WSAPlayer for the universal windows application compiled using il2cpp and it was working.
For some reason, il2cpp is not compiling, so I switched to .Net build and it works and runs correctly, except when I start loading an asset bundle built using BuildTarget.WSAPlayer, I get the following error.
“Can’t be loaded because it was not built with the right version or build target”

Actually before this error, I get this error during loading the manifest.
“Serialized file contains typetrees but the target can’t use them. Will ignore typetrees.”

Porting to windows 10 is not as easy as I expected. I hope it worth the effort. :slight_smile:

Any help is greatly appreciated.

Hi,

sorry for the late reply.

Asset bundles for il2cpp and .NET scripting backend differ, and when you build them, the current scripting backend setting is used. If you built them when the scripting backend was set to IL2CPP, and want to use them with the .NET scripting backend, you'll have to rebuild them after changing to .NET scripting backend in the player settings.

@Tautvydas-Zilys OK, I will try.

Hey @Tautvydas-Zilys ,
I'm curious as to why the asset bundle would be different between il2cpp and .NET. Asset bundles can't actually contain any running code that would need to be loaded into the assembly. My understanding is that asset bundles are just binary blobs (e.g. for images) with some metadata in xml (or yaml or json or whatever) format. So why would the format of the asset bundles change between platforms?

They're serialized differently. The metadata is not in XML or any other standard format. It's our own custom binary blob. The way serialization works on .NET scripting backend is not compatible with how it works on IL2CPP scripting backend, therefore the resulting asset bundles end up being different.

Hi!
Sorry to hijack this old thread.

@Tautvydas-Zilys is this also true for other platforms, e.g. Android?
E.g.: If I build my AssetBundles with Mono backend active, do they work less performant, if the final build of the APK (not AssetBundle) then is IL2CPP?
Or won't they load at all?
Or does this only affect Windows Store?

We often switch to MONO while developing and only IL2CPP for release. But we never paid attention to what setting is active when building the AssetBundles.

Thanks!

This only affects UWP with .NET scripting backend. Mono and IL2CPP use the same serialization path, while .NET uses a separate one.

Thanks for the update!

Tip: This can be caused by uploading via FTP using ASCII instead of Binary!

3 Likes

omg thank you, that’s right!
I reuploaded my files in binary mode and now it works.

1 Like

Thank you!

How to make ASCII to binary?