Get Sprite by name packed inside of parent Sprite


How can I get the "Bows-Bow T0 Arrow" sprite by name, when all I have is a reference to the GameObjects Sprite?

The GameObjects sprite is a sprite sheet :


I tried using Sprite Atlas, but it's not viable for this project. It's very slow and crashes on import sometimes. I'm using TexturePacker with it's importer now :


If I was using a sprite atlas, I would do the following :

            int spriteSize = atlas.GetSprites(spriteArray);

            for (int i = 0; i < spriteSize; i++)
                var sprite = spriteArray[i];

To iterate through all the children sprites in the parent sprite.

Any clues will be VERY appreciated!


Some people suggest using 'AssetDatabase' :

string spriteSheet = AssetDatabase.GetAssetPath( txt );
Sprite[] sprites = AssetDatabase.LoadAllAssetsAtPath( spriteSheet )

But that is Editor only. Not viable. Some people suggest using Resources folder :

Sprite[] sprites = Resources.LoadAll<Sprite>(;

Not so sure about that… I try to avoid using the Resources system.

Other people suggest referencing each sprite one by one. I want the process to be automated, this is still not viable.

Some people mention you can add the packed sprite into an atlas and request sprites by name using the sprite atlas... I tried it without any luck. When I get a sprite it's null.

How unfortunate! Well then, that's your loss. It's built in, it works 100% of the time, it's fast and performant.

With Resources.LoadAll() you will get a list of sprites and each has a name to can check.

I guess you're stuck setting up Addressables or something, or dragging them all into something and searching that something... then making some kind of table indexing system. Yuck, I hate writing code that duplicates something as powerful as Resources!

Good luck!

1 Like



Bummer, there's no way to get the sprites using Addressables.

I've found a workaround, I'm packing the sprite sheet into a sprite atlas, and now I can get the children sprites using GetSprite.

1 Like

What Unity recommend and what actually works for your project are two different things. You should do whatever works for your project.

And at the end of the day - if you don't want to use Resources - you will need to pre-cache this information. Such as having a scriptable object that stores references to these sub-assets (Either direct ones, or Addressable Asset references). Wise to use editor-code to automate this.

Resources is just a hard-coded/built in Asset Bundle, so it's effectively doing the same thing you would with Addressbles anyway.


Totally agree. Cheers!

1 Like