Hello, having a problem with addressables system. I have ~50 pictures, and I want a player to change between them. I can’t hold all of them in the memory at the same time, so I want to load them when a player clicks. All pictures must appear instantly. And here is the problem. As you know, addressables use package system. And I have 2 options:
-
Release an old picture (that unloads package), that frees the memory. Then load a new one.
Problem: addressables need a half of second to load a new object from packacge, I need an instant load.
-
Load new picture from package (it takes 0 seconds because I have already loaded smth from package). And then I release an old picture.
Problem: as you know addressables release memory ONLY when full package is unloaded, so an old picture stills in memory. And I can free the memory only when I unload the last loaded picture without loading a new one.
Am I doing this right? May be there is another third option? Or I don’t understand addressables mechanics. And I am not sure if the thing about half of second and 0 seconds is intended, or it is my personal PC bug btw.
Thanks!
@MemoryFortyTwo , Hi there, sorry for the delay in replying. I’m assuming when you say “Package” here you mean “Assetbundle” - please correct me if I’m wrong in this assumption!
You are correct in your understanding of assetbundles in the sense that once one thing is loaded in from the assetbundle, everything is loaded from that assetbundle, and that the assetbundle will not be unloaded until everything from the assetbundle is unloaded. It is also unfortunately true that there is some overhead when loading in an assetbundle and as a result, especially if the assetbundle is large, a small delay as something is loaded is very possible.
As for my recommendations on what to do, one possibility is to break the pictures into smaller asset bundles - rather than having them all in the same assetbundle, you could segment them into smaller assetbundles that contain pictures you’re likely to use together. This way, even if there needs to be a small delay as you load the first picture in the assetbundle, the following pictures will all be loaded and can be viewed instantly. This should also decrease the amount of delay between the load call and when the picture is loaded, since the assetbundle will be smaller and easier to load. Let me know if this solution works or if you find something else that seems to solve your issue. Thanks!
1 Like