How to find the reason why an AssetBundle is being rebuilt?

Unity 2019.4.20f1, Addressables 1.18.13

I have the problem that two consecutive content builds, during the same editor session even, produce different bundles for a few AssetGroup’s. In particular scene bundles are affected, but these scenes don’t contain any UI. I’m mentioning the UI, because I’m aware that UI causes unstable content hashes ( see here ).

This issue reproduces only when I build through our Jenkins build server. It does not reproduce when building locally.

How can I look into the generated bundles to understand what exactly changes? I’m unable to find tools that would help. I tested Unity’s AssetBundle Analyzer, but it doesn’t seem to be useful for this use-case. I also checked a few AssetBundle modding tools (AssetStudio, uTinyRipper), but none of them is able to open any of my bundles.

I must get bundles for unchanged content stable between builds, to avoid that users have to download the same, basically unchanged content, over and over again.

It’s an annoyance for users and the unnecessary download traffic costs us money too.

I’ll kick this over to the team for some guidance!

1 Like

You can use WebExtract and binary2text tools shipped with Unity to extract the serialised files and compare them between the two AssetBundles.
see https://support.unity.com/hc/en-us/articles/217123266-How-do-I-determine-what-is-in-my-Scene-bundle-

If Scene’s are affected then it is likely you have either OnPostProcessScene callback that does some modifications or you have Scripts in the Scenes that have ExecuteInEditMode or Awake, which runs during the build and can cause indeterminism depending on what you do in the methods.

If you find out it is something on our end then we could look into it, if you are able to send a bug report

2 Likes

Thank you for the reply, that was very helpful.

The problem was that our project called DynamicGI.UpdateEnvironment during the EditorSceneManager.activeSceneChanged and EditorSceneManager.sceneOpened events.

This caused some lighting related properties to change in the scene, or to be more precise it changed the following properties:

  • m_AmbientProbe (SphericalHarmonicsL2)
  • m_IndirectSpecularColor

The code that’s calling DynamicGI.UpdateEnvironment is from 2018 and has the following comment on top:

// Call DynamicGI.UpdateEnvironment() to workaround what seems
// to be an engine-bug, where the shadow-side of objects is
// pitch-black after a recompile or opening a scene.

I’ve removed the call to DynamicGI.UpdateEnvironment and the scenes checksum seem to be stable now. I hope this isn’t just a lucky accident, but I’m hopeful that this was the actual problem.

2 Likes