Had this error when trying to use asset bundle built from 2021.3.9f or newer in older Unity version (2021.3.2f)
Failed to decompress data for the AssetBundle 'Memory'.
Steps to reproduce:
Build asset bundle in 2021.3.9f or newer.
Open the project in older Unity version 2021.3.2f and load the asset bundle.
It seems like the 2021.3.9f or newer Unity version’s asset bundle is not backward compatible to older Unity project built. This causes a problem for our project as we need to upload new asset bundle for our existing apps that are already in Play/App Store. This issue affects Android and iOS platform. We have not tested other OS platforms and might have the same issue as well. No issue when loading the asset bundle with 2021.3.9f or newer.
The fix is backward compatible, meaning that newer versions of Unity can successfully to read AssetBundles built without those padding bytes. But the change is not forward-compatible, meaning that older versions of Unity without the padding code cannot read newer AssetBundles. Normally Unity is NOT forward-compatible, otherwise we would be unable to make any improvements to the file format at all, and its quite rare that this format changes at all. However it is unfortunate when a small adjustment to the format like this causes trouble, such as in the scenario you describe. To work properly the apps should be rebuilt with the new version, or, until upgraded, you should use the same version of Unity to build bundles as you used for your player build.
Thanks @AndrewSkow for the detailed information. That explains a lot why existing apps no longer works with latest asset bundle. I guess we have to force players to update app instead. We heavily refer to the Unity changelog when we upgrade the Unity version. Is it ok if this sort of info is included in the changelog, such as “forward-compatible breaking change”? We can then plan ahead to force player update apps before releasing new asset bundle.
Yes you make a good point. If there any further AssetBundle format changes we will do our best to flag that a lot more clearly in the change log. So far I am not aware of any bugs or improvements in our bug pile that would impact forward compatibility for AssetBundle files.
Hello, I have a live program built with 2021.3.6 that contains several Asset Bundles. I recently upgraded to 2021.3.34, built a new AB and the current build isn’t reading them. Can you confirm the format changes are the reason for this?
Unity does not have forward compatibility, so a player build with an earlier version of Unity is unlikely to be able to read content built with LATER releases of Unity. What works better is the backward compatibility case, but even then its not certain to work when doing larger upgrades of Unity.