Search Unity

Controlling Recursive Asset Loading

Discussion in 'Addressables' started by Zargy, Feb 13, 2020.

  1. Zargy

    Zargy

    Joined:
    Jul 13, 2014
    Posts:
    17
    I have a large number of ScriptableObjects that represent characters in my game. These SOs all have references to textures (the spritesheets), which are themselves large in size. Due to the number of characters, I would like to be able to load all the SOs so I have the data about the characters available, but only load the spritesheets I need when I need to display them to conserve memory.

    The issue is that if I use something like Addressables.LoadAssetsAsync<CharacterData>(...), it also loads the texture references alongside the SOs. (The textures and SOs are all under the same root path ("Characters/"), if that matters.) Is there an easy way in addessables to load a type of asset and leave some or all assets that it references unloaded until I need them?
     
  2. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    You can use AssetReferences in your scriptable objects instead of direct references.
     
  3. Zargy

    Zargy

    Joined:
    Jul 13, 2014
    Posts:
    17
    Okay, thanks.