Search Unity

What are these and how many IO calls do they produce?

Discussion in 'Asset Bundles' started by laurentlavigne, Jun 1, 2020.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    upload_2020-5-31_23-16-40.png
    I see 100+ meg files, does unity load them all in one block or spam the disk with IO requests?
    How do I know which contains what?
    Is their content deterministic (each time I change one file will most of them remain the same)?
     
  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    :eek:
    deterministic = false

    upload_2020-5-31_23-56-39.png
     
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    It's bad enough Nintendo actually rejects Switch games made in Unity if they don't use asset bundles (unless the game is really, really small), because the built-in resources system all but guarantees your updates will be as large as the base game, no matter how small are the actual changes.
     
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    I'm surprised how crazy that is, I don't want to redo the asset loading just because Unity decided to reshuffle a bunch of id or whatever. You don't see SQL changing indexes each time you change a cell...
    On the bright side Steam seems to wrangle delta alright.
    (and Switch talk is on Nintendo forum only, my dude)
     
  5. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Steam's patching system is miraculous. Other platforms, not so much. Without bundles (or Addressables, bugs notwithstanding), your updates will be almost as big as the entire game. The processes that turn your assets into resources is non-deterministic, producing different outputs even if the inputs are unchanged.

    What puzzles me is why Unity seemingly never tried to improve the system, instead building workarounds on top of it (asset bundles, and then Addressables on top). It's as if there's no one left at Unity who knows enough about that particular code to fix it.

    Another problem involving this is memory management. AFAIK, Unity will only ever unload assets in the following situations:

    - Loading a scene non-additively unloads all assets from the replaced scene(s) .
    - Calling Resources.UnloadUnusedAssets() will unload all unreferenced assets (from unloaded additive scenes, for example). This will cause a major hitch on the main thread, however.
    - Calling Resources.Unload() for assets you loaded using Resources.Load() or Resources.LoadAsync() will unload that specific asset.
    - Calling Unload() on an asset bundle can unload all assets loaded from that bundle and references to them will be invalidated.

    As you can, if you have a game where you want to seamlessly and smoothly stream assets in and out of memory without leaking you are in for a bumpy ride. Addressables is the closest out of the box feature to get there, but it still has a few issues that can creep up and bite you hard if you're unlucky (see the Addressables forum).
     
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    Thanks @KokkuHub I will read more about addressables.
    Since we're both under NDA and I'm just dipping my toes, let's continue this conversation off forum, I am very interested in seeing what a F***ing nightmare is awaiting.