Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode allows you to make a "sprite Atlas" from within Assets.xcassets, is it actually an atlas?

If you're in the Assets.cxassets folder and hit the plus sign, you can among other things add a new "sprite atlas" and/or new folder.

when you create either a "sprite atlas" or folder from this menu they both look exactly the same. I was under the impression that an atlas folder had to have the suffix ".atlas" at the end of it?

I read that using a sprite atlas is generally better for a lot of repeated textures on screen. I created a "sprite atlas" inside Assets.cxassets when I started my project and have been putting all of my images into that folder.

The more I'm reading about it the more I think I did it incorrectly. I can't find a single thing online about having your "atlas" folder inside Assets.cxassets. and when I created the atlas folder like I mentioned above it didn't have the ".atlas" suffix, it just had a generic name of "sprites"

I'm also using all of these sprites with a tile set, is using an .atlas in a tile set common practice?

thanks for all advice.

like image 629
genericguy25 Avatar asked Jul 26 '17 23:07

genericguy25


1 Answers

Yes, it is an actual atlas.

When you open assets catalog from your Project Manager and add things like atlases, groups (folders) or say, Watch Complication, those might look the same to you in the Xcode...

assets

But behind the scenes those are not the same. This is how these folders look on disk:

enter image description here

So, if you right click on the assets catalog, and select Show In Finder, you will notice that there is .spriteatlas extension on Atlas folder, .complicationset extension on Complication folder and that there is no extension found on New Folder. This means that each folder from assets catalog actually has its own type defined by its extension.

This is from the docs:

The type of content represented by a folder is encoded in the extension for the name of the folder. For example, a folder named PosingLlamas.imageset has a type of imageset.

So, you can conclude that, if you are interested in sprite atlas features, you must create a new sprite atlas, rather than a group (folder), and Xcode will do the rest for you. Otherwise batch rendering (rendering multiple textures in a single draw pass) would not work which is the main feature of sprite atlases and helps with performance greatly.

like image 75
Whirlwind Avatar answered Oct 22 '22 11:10

Whirlwind