Monday, January 24, 2022

Unity batch atlas creation

In our game we use a few sprite atlases based on a single master atlas (HD astc, HD etc2, SD astc and SD et2). Each atlas has different settings for each platform. Manually creating all these copies with all the settings takes some time and is very error prone. So I created a tool that let's you select the folders you want to include and the rest is automated. 

The user can simply select the folder(s) they want to include and the rest is done automatically. Per atlas a TextureImporterPlatformSettings and a SpriteAtlasTextureSettings object instance is created with the correct settings and fed into a function that creates the atlas, making it addressable. All pretty straight forward.

The script searches up from the selected image folder until it finds an *_atlas folder, since that is where we set up our atlases. When that folder is not found the atlases are saved next to the selected folder.

One thing we could still do is base new atlases on import settings files in a certain predefined folder instead of the hard coded settings that we have now. We could then also dynamically add new variants and let the script create a copy for each settings file found.


No comments:

Post a Comment