Are Load calls synchronous if the asset is already loaded?

Hi,

Does Addressables.LoadAsset run synchronously if the asset has previously been loaded?

Thanks

No. Addressables.LoadAsset has been depreciated/renamed.

Addressables.LoadAssetAsync will always return a AsyncOperationHandle. You should never assume something has been previously loaded.
You need to manage this yourself by caching the AsyncOperationHandle or result. This is best practice anyways because you may want to free those assets later.

I see, thank you for the explanation.

With that said, is there a way to Addressables.LoadAssetAsync all registered addressable, without providing keys? (So I can cache the result for synchronous lookup)

Also, I assume due to the reference counter, that is it only when the counter is 0 that the asset is either loaded / unloaded. Otherwise an internal reference would be returned? (So there would be no performance hit to hitting LoadAssetAsync potentially many times in many places)

Thanks again.

Update - It looks like labels are the way to go for this.

Hmm Yeah, I assume there is not performance hit with multiple Loads. These should be cached from my understanding. Correct only when references are 0 will the asset be released.

Yeah labels would be the way to go. Otherwise you can load via directory.

I wrote the code below to await upon, with the intention this will pick up every Addressable. However, this also appears to include duplicate of my Addressables with PrimaryIds of: “UI/Alert.png” and “UI/Alert.png.Alert”.

    public async Task AsyncLoadAssets() {
        await Addressables.InitializationOperation.Task;

        foreach(var locator in Addressables.ResourceLocators) {
            var handle = Addressables.LoadResourceLocationsAsync(new List<object>(locator.Keys), Addressables.MergeMode.Union, typeof(Object));

            await handle.Task;

            foreach(var location in handle.Result) {
                Debug.Log(location.PrimaryKey); //There seems to be duplicates in here?
                //PERFORM ASYNC LOADING LOGIC HERE & STORE CACHE
            }
        }
    }