Hello all, I’m trying to understand how the internal caching mechanism works inside the Addressables system, but it is too inscrutible for me to figure out. Hoping someone can help!
My project has a mix of Addressables.LoadAssetAsync(), AssetReference.LoadAssetAsync(), and good old fashioned drag-and-drop direct references.
Ideally, I’d like all 3 of these things to be able to point to the same underlying instance of an object. This idea seems to work ONLY if every reference is managed via the AssetReference class. If I’ve previously loaded an asset via Addressables.LoadAssetAsync() and then try to access that same asset via an AssetReference, a whole new load operation is kicked off and I appear to end up with duplicate instances in memory. Same goes for direct references, though I’m not at all sure which “bundle” those end up in or how I could ever relate them back to the cache that the Addressables system maintains.
I essentially want to be able to load and initialize all my data up front via a few simple calls to Addressables.LoadAssetsAsync() and then have every reference elsewhere in the project be handed pointers to this already-initialized data without Unity making duplicates all over the place and blowing up due to uninitialized data.
Would very much appreciate some clarity on how this could work! Thanks -