Loading asset from bundle fails from unknown reason

Hi everyone.

We’re using a custom asset management solution in our project (not using Addressables).

AssetBundles has started failing randomly in one of our project, whereas it works in the other project.

The problem:

  • AssetBundle.LoadAsset returns null, when it’s not supposed to.

What we’ve checked:

  • Disk size of the AssetBundle is as expected. We’re getting the bundle size at build time and write it into a json, and read size the disk on Player and it’s the same.
  • AssetBundle.Contains(name) returns true.
  • The object type is as expected.

Extra info:

  • We’re trying to load a video clip asset.

Any ideas on what could be the reason?

The issue was caused by Engine Code Stripping. It’s a shame that Unity doesn’t have a proper error log for this.

Seems to be fixed in Unity 2022.