Search Unity

TypeTreeHash and AssetBundle Unity version compatibility

Discussion in 'Asset Bundles' started by dlegare-synapse, Aug 12, 2019.

  1. dlegare-synapse

    dlegare-synapse

    Joined:
    Jan 17, 2018
    Posts:
    12
    I noticed that in the manifest file for an asset bundle there's a value
    TypeTreeHash
    . The only documentation that I can find referencing this value is the documentation for BuildAssetBundleOptions.DisableWriteTypeTree, which says:

    I'm curious about what this means for AssetBundles normally. What does being "susceptible to script or Unity version changes" mean in this case? Will loading an AssetBundle with an incompatible script version cause my player to crash if I disable writing the type tree information?

    On the flip side, how does Unity handle script changes in asset bundles normally? Can a built player load an AssetBundle that contains different script versions? How does Unity handle deserializing missing fields in that case?
     
  2. dlegare-synapse

    dlegare-synapse

    Joined:
    Jan 17, 2018
    Posts:
    12
    I did some experimentation, and it seems like a built player can load asset bundles that have a different script version as long as you don't disable type tree information. In this case, any missing serialized fields will have default values, and any unknown fields are ignored. I was also able to confirm that a built player won't load a bundle built with the
    DisableWritetypeTree
    option if the script data doesn't match, which makes sense based on the documentation (though I wish the documentation had specified this directly).

    Does this also apply to asset bundles built across Unity versions? Specifically, I'm curious if a player built from a newer version of Unity will reliably be able to load asset bundles built from an older version. For example, would a player built from Unity 2019.2 be able to still load asset bundles built from Unity 2018.4?