Looping through each item and individually async loading its asset?

hi UE peeps :waving_hand: , an optimization question

I’m creating an inventory system and I would like to know if its a good idea to load soft object refs(Item Data Assets), through a loop that stores the loaded data asset in a map so the next loop can check that map for fast retrieval instead of relying on Async Load Asset for each item (in the loop)

Hello!

If I understand your idea right, it’s basically loading the items in the background so you can that the items loading doesn’t interrupt the rest of the game. I think the only problem is that it’ll take up memory space, by having all Item Data Assets loaded all the time. But if they’re small enough or few enough, and depending on your project’s requirements, this may not be an issue. Up to you!

One thing I would try instead, is using it as a sort of on-demand loading. When an item is needed, check the map. If it’s not there, you do that item’s first Async Load Asset and store it in the map (as opposed to storing in the map before the item is even requested). The only issue with that is that depending on how long it takes to load one item, it might be noticeable, but on the flip side, you never load items that aren’t necessary.

storing the assets will keep them permanently alive which makes you responsible for memory management, which can be fine.

Async load is instant if its already loaded anyway or you can even try resolve the soft ref first and if its invalid load then.

DataAssets also support asset bundles which can load groups of assets.

i cant really give you a concrete answer it depends on your game, most indie games can probably get away with all assets in memory, but then maybe you dont need soft refs at all.