Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How to manage resources ! @unity_bill and all friends

Discussion in 'Addressables' started by wangyucheng1992, Mar 28, 2019.

  1. wangyucheng1992

    wangyucheng1992

    Joined:
    Feb 19, 2019
    Posts:
    52
    Hi friends
    something about addressables play:
    1. every group will be build a bundle when click build all;
    2. when we load a prefab,it will automatically loads all dependent resources;

    some question about 2:
    I have 100 actors in a game, but i just need 8 actor(random access) every battle, I put all 100 actors profabs in one group(will be builded Bundle_1),and all dependent resources(texture,material,shader and so on) in another group((will be builded Bundle_2)) ,there will be put in remote server.

    Now I load one actor(A) [ Addressables.LoadAsset<T>(key) ] ,The system will automatically load all dependent resources first than return A?

    Q: in this example we bulid two bundle Bundle_1 and Bundle_2, when i load prefab A(in Bundle_1 ), AddressableSystem will download the whole Bundle_2(dependent resources) in The local hard disk then load the whole Bundle_1 in The local hard disk first, second decompressing the two bundles, third load all dependent resources of A then load A into memory and return a result ( the whole A ).
    What I sad is right? if not someOne can show me a real loading process, thank you!
     
    Rafarel likes this.
  2. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    393
    Use "Pack Separately" and each prefab will be packed in its own bundle. That is the best approach when you have a huge amount of different assets but require random assets. If you always need the same 8 actors, the best way is to pack those together. Let's say the grouping is static before you build your player, in that case you can write a script to pack each asset in the correct group before you build your player.
     
    unity_bill likes this.
  3. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    45
    @MNNoxMortem Do you know what happens to shared resources when using pack separately?

    For example, you include 2 prefabs in one group, each prefab using Material A. If you "Pack Separately", each prefab will be put in its own bundle. What happens to the shared Material A?
     
  4. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    393
    @Jribs The material will be duplicated. Use the option to extract the shared material from the menu ("Find problems "- or something like that).
    You want to have one bundle with the shared resource and 1 for each non-shared group of things. if you load 2 groups with a dependency to material A then the material bundle will be loaded only once.