[Feature Request] API Able to mark assets in Resources folder as addressable by C# script

I manage to get it working by making AddressableAssets.MoveAssetsFromResources a public function.

I wish I had a safer way to do that.

My example code:

var settings = AddressableAssetSettingsDefaultObject.Settings;
var group = AddressableAssetSettingsDefaultObject.Settings.FindGroup(groupName);
if (!group)
{
    throw new Exception($"Addressable : can't find group {groupName}");
}
var entry = AddressableAssetSettingsDefaultObject.Settings.CreateOrMoveEntry(AssetDatabase.AssetPathToGUID(path), group,
    false,
    true);

if (path.Contains("Resources/"))
{
    var newName = path.Replace("\\", "/");
    newName = newName.Replace("Resources", "Resources_moved");
    newName = newName.Replace("resources", "resources_moved");

    settings.MoveAssetsFromResources(
        new Dictionary<string, string>() {{AssetDatabase.AssetPathToGUID(path), newName}}, entry.parentGroup);
}

if (entry == null)
{
    throw new Exception($"Addressable : can't add {path} to group {groupName}");
}
entry.labels.Add(groupName);
settings.SetDirty(AddressableAssetSettings.ModificationEvent.EntryMoved, entry, true);

I’ll forward your suggestion to the team for review!

Hey, good suggestion. I don’t know if or when we’d get to something like this but I did want to throw out a suggestion. If you wanted to you could rename your Resources folder to Resources_moved or whatever you like and then drag that entire folder into an Addressable group, marking the entire thing (and all the assets inside it) as Addressable. Though, that might not be exactly what you’re looking for.