How to auto add entire folder with simplified names? / Load by id?

I want to just tick a folder as addressables. Yet when I do that all sprites have Path of Backgrounds/SpriteName. I used to just load by spriteName. Yet with folder tick the path contains ‘Backgrounds/’ I cannot load now with only spirteName.

How can I still load by name while having ticked folder, instead of ticking every single sprite and simplifying names manually on every newly added sprite/vid?

Is there a smarter solution for this? I have hundreds of sprites/videos. I have to use the name for obtaining it.

How I handle loading sprites, clips by id only.

var backgroundID ="testSprite";
            if (bg is null)
            {
                var op = Addressables.LoadResourceLocationsAsync(backgroundID, typeof(VideoClip));
                await op;
                if (op.Status == AsyncOperationStatus.Succeeded && op.Result.Count > 0)
                {
                    var handle = Addressables.LoadAssetAsync<VideoClip>(op.Result.First());
                    await handle;
                    ticket.assetHandle = handle;
                    bg = handle.Result;
                }
            }

            if (bg is null)
            {
                var op = Addressables.LoadResourceLocationsAsync(backgroundID, typeof(Sprite));
                await op;
                if (op.Status == AsyncOperationStatus.Succeeded && op.Result.Count > 0)
                {
                    AsyncOperationHandle<Sprite> handle = Addressables.LoadAssetAsync<Sprite>(op.Result.First());
                    await handle;
                    ticket.assetHandle = handle;

                    bg = handle.Result;
                }
            }

Thank you.

For our project, ticking folders like that wasnt worth it for us. It created too many restrictions, much like the one you are describing. There are some other issues as well, its been a while since i had to deal with it but I recall it caused issues with dependencies because it wouldnt recognize those individual files as being in an addressable itself, so it still got pulled into other bundles. This was a couple years ago so that issue might have been fixed.

Instead we basically created our own system that adds individual files in folders so we can control how they are handled.

So functionally we still have the ease of use of being able to set a folder and all of its contents as addressables, but we just have a step before we build that auto cleans up the bundles.

@Jribs ;/ I though this kind of functionality would be out of the box. Either way thank you for the answer :heart:

Yes, they should really add an option to toggle whether the folder path is included in the address by default!

However, you can correct the addresses to remove the folder paths pretty easily so long as all of the assets you have added are in the same folder. To do so:

  • Once you add the assets (by dragging and dropping them onto the Addressable Group you want them to be in), you must save your project (this will update the group asset file, which is needed for step 2).
  • Click on the Addressable Group within the Addressables Group window. This should auto-select the Group asset in the Project Hierarchy.
  • Right click the Group asset and select “Show In Explorer/Finder”. Open the .asset file (not the .meta) file for the group asset, using notepad or whatever IDE you want.
  • Select the folder path you want to remove and then use the IDE’s Replace option to replace all instances of it with an empty string.
  • Save the file and close it.
  • Back in Unity, save your project. You will notice the addressable names have not changed. Restarting Unity will update them, so do so and confirm they have been changed.
  • Win.

Edit: I know I am necroing an old thread and this might not be useful for the OP, but if anyone else comes across this thread like I did, these instructions could be useful.