Search Unity

Preloading flow.

Discussion in 'Addressables' started by Delament, Sep 14, 2018.

  1. Delament

    Delament

    Joined:
    Nov 28, 2014
    Posts:
    1
    Hi,

    I have some general questions about the system and was wondering if anyone could help:

    1. From what I understand, when using 'Load' the asset is downloaded (if necessary) and loaded into memory. I assume then, that a call to 'Instantiate' would more or less be instant as the asset is ready. But, I've read that assets are automatically released when there are no references to it, which would apply to the time between Load and Instantiate (assuming they happen over a period of time). Is this true?
    2. For preloading, say in a splash screen, would you: use the methods that load from a list (LoadAssets), call load individually on each reference in one go or call load on each asset but only as the previous operation completes?
    Thanks! Liking the system so far!
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    1. If you actually call Load, that increments the ref-count. So the asset will never be unloaded until you call ReleaseAsset. If you Load then Instantiate, your ref-count is now at two, and you need to both release the instance and the asset when done.
    2. If you are preloading, call as much as you can at once. That way any downloads can happen concurrently (if possible). One note, we have a PreloadDependencies api that does downloading if needed, but does not keep things in memory. So if you just want to download, but not cache in memory, use the Preload. if you want it to stay in memory, use Load.

    -Bill
     
    s-vovik and optimise like this.
  3. diego_mp

    diego_mp

    Joined:
    Jun 12, 2017
    Posts:
    23
    Let's say I want to preload ALL my assets, is there a way to do it or do I need to load from label/path/etc one by one?
    I could assign a default label then use it as key but it's not ideal.
    How can I download an asset with no label?
    Please bear in mind that I want to download all the offline content without knowing what it is.
     
  4. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    that's the only "load all" option today. We have it on our list to make this cleaner because we know it's far from ideal.