To address your concerns about exporting PNGs from Spine and managing their size in Unity, here are some steps and tips:
Exporting Based on Folders:
- You can control which images are grouped together on the same atlas page by organizing your images into subfolders. When exporting, Spine will create separate atlas pages for each subfolder. This should help in creating two PNGs based on your two main folders.
- Refer to the Texture Packing - Spine User Guide: Folder structure for more details.
Reducing PNG Size:
- Use PNG Optimization Tools: Tools like
pngout
orpngcrush
can help further compress your PNG files. Ensure that your game toolkit can still open the resulting PNG files after compression. - Reduce Bit Depth: You can reduce the bit depth from 24 bits to 8 bits, but this will limit the colors to 256. This can be done using tools like Photoshop or
opt-png
inlittleutils
. - Scale Down Textures: You can scale down the texture atlas during export. This will reduce the size but may affect the quality. You can do this by adjusting the scale settings in Spine.
- Use Binary Export: Export your data in binary format and compress it using algorithms like deflate, lzma, or lzo. This can significantly reduce the file size.
- Premultiply Alpha: Ensure that your PNG files are exported with premultiplied alpha if your compression tool respects PMA. This can help in maintaining the quality of transparent areas.
- Adjust Texture Import Settings in Unity: Ensure that the texture import settings in Unity are optimized. Disable compression if it causes issues and ensure that the textures are set to full resolution.
- Use PNG Optimization Tools: Tools like
Runtime Repacking:
- If you are using multiple pages, you can repack the textures at runtime. This is useful when you have many costume differences and need to change them dynamically. Refer to the spine-unity Runtime Documentation: Combining Skins for more information.
Example Scene:
- You can see a demonstration of skin combination and texture repacking in the example scene
Spine Examples/Other Examples/Mix and Match Skins
.
- You can see a demonstration of skin combination and texture repacking in the example scene
By following these steps, you should be able to manage the size of your exported PNGs more effectively while maintaining the quality of your 2D textures in Unity.