Hello !

I'm looking for some kind of way to predict the name of the atlas pages exported by Spine.

The goal would be, in Unity, to override the Material using a specific atlas page, in order to swap it with another atlas page.

The thing is, when exporting from Spine, the exported texture names look like "avatar.png", "avatar_2.png"... making it difficult to know which atlas corresponds to which semantic part of a skeleton.


For example, let's say we have the following images folder hierarchy :

It would be nice after packing if the atlas page names looked like "avatar_base.png", "avatar_event_H.png", ("avatar_base_2.png" if needed, and so on...).

Therefore, we could for example make small edits on "avatar_base.png" and save an "avatar_alt.png".
At runtime, we could override the Material using "avatar_base.png" and swap it with "avatar_alt.png".

With the following example, that would mean we would have a "male.png" and a "female.png" atlas :

I spent quite some time reading the texture packing doc (http://fr.esotericsoftware.com/spine-texture-packer) and I feel like I'm missing something to get this workflow ^^"
Any help to achieve this would be highly appreciated ! :)
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
  • Beiträge: 8


it's great that you read the right docs already, did you also try to repeat this process and apply it to your files? If yes, what didn't work as you would have expected?

If you notice, the examples rely on the male and female avatar being in separate folders. Each folder has a .pack file in it and this allows to have the different results. You can also just run texture packer several times to have the different atlas names as you prefer them if it helps?

  • Beiträge: 2982


So, I tried what I could from the Spine but never succeeded to achieve the desired workflow, which is : exporting the json+atlases+texture in the same time, with atlas names matching the folder hierarchy.
Erika hat geschrieben: You can also just run texture packer several times to have the different atlas names as you prefer them if it helps?
This would work... But the attachment paths lose the actual path.

In the Spine project, the image path contains the full path (e.g. "event_H/arm_L").
When exporting from Spine editor (with atlas packed per "Image folder"), the attachment paths also contain the full path.

However, when running texture packer for each image folder (from Spine GUI or from CLI), the paths are stripped from the attachments (e.g. "arm_L" instead of "event_H/arm_L").

Hence a little surprise in Unity when the SkeletonDataAsset couldn't resolve the atlases.

I found a user who had the same issue :
pathfinder hat geschrieben:Besides this, a little question about exports. Since we are using a folder structure each export png is named after the skeleton (avatar_avatar_1, avatar_avatar_2), for organization purposes, how could we map the names to the folders used for the pngs? I saw that with a post build script could be possible, but I could not find some examples to base on.
So I'm a little disappointed this apparently common use case isn't implemented out-of-the-box in Spine, from GUI or CLI (that would be a really nice feature ! :) )


I end up doing what is suggested here :
Harald hat geschrieben:So you could use a bash script to automatically setup directories and copy your images following the desired directory structure. E.g. for attachment names like "myskin/arm" you would below a top export directory "export" have a directory "myskin" where you place the attachment image "arm". Then you would run the texture packer via the command line interface on the "export" directory. Then you can continue with setup for the next atlas, export it via the CLI, and so on.
It works quite well (thanks Harald), but I have to say this is not the most intuitive and straightforward way to go ^^"
  • Beiträge: 8

Zurück zu Editor