Basically, my game is composed of 1000+ levels, and the content of each level is inside a folder. Each folder contains 3 text files (1.bytes, 2.bytes, data.json) that are used by the level. The goal is to load those text files when they are needed (when a level begins), and then destroy (release) them when they are no longer needed.
This is how I am using Addressables at the moment:
1.) Drag all the level folders inside an Addressable Group titled “Content” and add a label to each folder so it can be loaded later.

2.) Load the text files from a folder via the code below:
private AsyncOperationHandle<IList<TextAsset>> aoh;
// this method is called to load the level assets based on level number
public void LoadLevelAssets(int levelNum)
{
string label = levelNum.ToString();
this.aoh = Addressables.LoadAssetsAsync<TextAsset>(label, result => { print(result); });
this.aoh.Completed += this.OnLevelAssetsLoaded;
}
// oncomplete handler
private void OnLevelAssetsLoaded(AsyncOperationHandle<IList<TextAsset>> obj)
{
var theList = obj.Result;
foreach(var item in theList)
{
print(item.name); // outputs the files names ("1", "2", "data")
print(item.text); // outputs the actual text inside the file
}
}
// method to destroy/release assets
public void ClearLevelAssets()
{
Addressables.Release(this.aoh);
}
The issue:
Labeling each folder is fine for testing, but if my game has 1000+ levels, it would be impractical to add a label to each folder one by one. Is using labels really the only way to load a folder? Is there a better way of doing things?
I know another way would be to just mark all the text files as addressable, and load each one via its address, but there doesn’t seem to be an easy way to do this too as I’d have to expand each folder one by one and select the text files inside those.
Any insight on a better way to do this would be appreciated. Thanks.