Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Embedding data inside asset bundle binaries

Discussion in 'Asset Bundles' started by liortal, Mar 6, 2019.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    We would like to add custom debug data inside our built asset bundles (for example - which git branch was used for building the assets, date time, etc).

    One of the solutions offered by one of the developers on the team was to append this data to the asset bundle file (e.g: the text itself is appended to the asset bundle binary file).

    This doesn't seem to break loading and using of the asset bundle, and also allows us reading this data from the end of the file.

    My question is - can we assume this method is safe? will it work on mobile devices and on all targets? or it could break due to the way asset bundles are read at runtime?

    Any words of advice would be great! cc: @ryanc-unity
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    I'd rather put a ScriptableObject or TextAsset inside the bundle, with a known name (if you need to read it inside unity)
    or generate a parallel file with your info and the hash of the bundle (if you need to read it from external tools. zip/tar them together post-build if needed, but the game should download only the bundle, not the info)
     
    liortal likes this.