Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

Discussion in 'Windows' started by Stranger-Games, Dec 29, 2015.

  1. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    392
    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. :)

    Any help is greatly appreciated.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,521
    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.
     
  3. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    392
  4. Julien-Lynge

    Julien-Lynge

    Joined:
    Nov 5, 2010
    Posts:
    142
    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?
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,521
    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.
     
  6. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    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!
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,521
    This only affects UWP with .NET scripting backend. Mono and IL2CPP use the same serialization path, while .NET uses a separate one.
     
  8. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Thanks for the update!
     
  9. lumeneo

    lumeneo

    Joined:
    Mar 3, 2014
    Posts:
    60
    Tip: This can be caused by uploading via FTP using ASCII instead of Binary!
     
    limeforce, AbgaryanFX and glardon like this.
  10. glardon

    glardon

    Joined:
    Apr 8, 2015
    Posts:
    14
    omg thank you, that's right!
    I reuploaded my files in binary mode and now it works.
     
    AbgaryanFX likes this.
  11. limeforce

    limeforce

    Joined:
    Mar 4, 2013
    Posts:
    3
    Thank you!