• Editor
  • Dont export unused graphics

Related Discussions
...

im sure that this was an option?

when exporting, is it possible to omit the png's that are not visible in setupmode and are not keyed in any animations, so these images wont get packed?

You can uncheck "Export" when selecting the attachments in Setup Mode 🙂

Texture Packing - Spine User Guide: Packing
#1 "will pack only the images each skeleton references and ignores the folder structure and JSON files." When running the packer separately, all images in the input folder(s) are packed (regardless of the Export checkbox on the attachments). You can have the texture packer ignore a subdirectory by placing a pack.json file in that directory with the contents:

{ ignore: true }

You can then put all images you don't want to pack in that directory.

This is/may be more than just a matter of images being included in the atlas.

Even if it's not keyed and not visible in setup mode, the attachment will still exist in the SkeletonData. So when the runtime loader (standard implementation) tries to load that attachment, it will fail, and in most runtimes, including Unity, it will just fail to load/throw an exception.

So just excluding it from the atlas is not quite the solution.
Unchecking the "Export" checkbox on an attachment will exclude it from both the skeleton data and the atlas though, as @Shiu mentioned.

Currently, I don't think we have an option that automatically excludes unused attachments from your export.

Ah, good point. You'd need to write your own AttachmentLoader similar to AtlasAttachmentLoader, but return null if the region can be found instead of failing.

Shiu wrote
Nate wrote

issue with this is we have thousands of images, around different folders, and the export button has never been clicked.

It would have been good if you could omit these obsolete images from the skeleton's json and the packer. therefor no custom code would need to be required

I'm shuddering at the spaghetti monster of a skeleton this is.

This is probably be a good feature for the "Find and Replace" window though:
"Find Unused Attachments"
Then you can delete them from there, maybe.
[Find and Replace] Find and Remove Unused Attachments · #200 · EsotericSoftware/spine-editor

Until that official feature happens,
I think the second best solution is probably a json-processing thing that rummages the setup pose and all animations for attachment values, and then remove all the unused attachments from skins/default skin.