I have been advised to move away from the Resources system to the new Addressables system, which seems to have many advantages.
I need to convert the following code to use the Addressables:
public static void LoadDefs()
{
foreach (var baseTileType in Resources.LoadAll(Settings.BASE_TILES_PATH, typeof(TextAsset)))
{
var baseTile = Deserializer.Deserialize<BaseTile.Initializer>(((TextAsset) baseTileType).text);
BaseTileInstances.Add(baseTile.Name, baseTile.CreateInstance());
}
}
It is important for me to detect the type of TextAsset
because those are .yaml files that I need to load the information from. Then, derived from information in that YAML file, I load sprites that I need with Resources.Load<Sprite>(path)
later, but that should be simple.
The documentation is pretty unclear on how to do this. It mentions labels, but not much else.
How can I achieve a similar result with this new system?