I have a bunch of ScriptableObjects (like game items, player/NPC abilities, etc) that Im now migrating to addressables. My doubt is, how can I load all those objects of the same type, like items, to a list or dicitonary? I saw a little piece of code in a video, but it used coroutines and I would prefer something less complex.
I’d use the Addressables labeling feature. Label all your scriptable objects with what you would want to classify them as. Then, say you labeled all your item objects with the label Item you should be able to do something like
List<ScriptableObject> items = new List<ScriptableObject>();
public void LoadItems()
{
Addressables.LoadAssetsAsync<ScriptableObject>("Item").Complete += handle =>
{
foreach(var item in handle.Result)
items.Add(item);
}
}
Since you’re not using coroutines you’ll have to do something like this where you subscribe to the complete event.