The PhotoshopToSpine.jsx script sets up the .json file slightly incorrectly when you use ".png" in your layer names (to take advantage of photoshop's asset generator). The json imports fine into spine (except slots and image names are all ending in ".png", and displays images fine, but then when you export to Unity, the skeleton data cannot be read and cannot be imported (unless you fix the exported .json file manually, or delete all the slot images inside spine and replace them with a image without the ".png" in the name. Sorry I'm not very good at explaining, but I will try go into more detail below:

Photoshop CC latest version
Spine Pro latest version
Unity latest version
Spine Unity runtime latest version
PhotoshopToSpine.jsx latest version

In photoshop, a very useful thing to do is to end all your layer names in ".png", e.g. "skeletonMouth.png", as you can tell photoshop to auto generate these files into separate files whenever you edit it, which you can then use to place into your own 2D atlasses. Very useful if you have 100's of layers, I cannot get by without this.

When I run PhotoshopToSpine on the relevant visible layers, it doesn't trim the ".png" and includes it into the filename (as if it thinks its "skeletonMouth.png.png". The resulting json file names slots, images and default skin incorrectly as skeletonMouth.png instead of just skeletonMouth.

Spine reads this fine, except slots are named skeletonMouth.png aswell, instead of just skeletonMouth. Minor inconveniece, it's fine. But when you export to Unity, Unity cannot parse this correctly and I get some error about unable to read skeletonData. You then have to delete the image in each slot inside Spine, and re-drag each image (from the photoshop generated folder of images) into the correct slot again. Exporting now works, but incredibly time-consuming on large files.

My temporary solution was to add another function to the PhotoshopToSpine.jsx
function stripTags_ANDPNG (name) {
name = trim(name.replace(/.png/g, ""));
return trim(name.replace(/\[[^\]]+\]/g, ""));
keeping the existing stripTags(name) function. I replaced it in a couple of instances in the script:
layer.attachmentName = folders(layer, "") + stripTags_ANDPNG(; //REPLACED stripTags()
var boneName = stripTags_ANDPNG(; //REPLACED stripTags()
This now generates a nicely trimmed .json file and everything is working great now. However, I'm not a javascript expert nor do I know if this would effect anything else in the script. My photoshop files are generally pretty simple, although I know some artists use some quite complicated layer naming conventions when using the Photoshop Generate Assets syntax on layer names, such as "skeletonMouth.png50%". Refer to

I know its probably impossible to accomodate all the extra layer name syntax, but I think at least officially supporting .png would be great- especially for new users who may have already done their Photoshop artwork and are just trying Spine for the first time- if their files has .png layer names they would be extremely stuck on why Unity won't work nicely!
  • Сообщения: 9


Wow, what a great write up (and sorry for the issue)! As you said, it's hard to anticipate and accommodate all possible layer naming schemes. Your solution is correct! However, it might break other layer naming schemes.

We'll have to discuss this and figure out the implications of this change internally. I've created an issue here: Strip .png from layer names in Photoshop export script · #424 · EsotericSoftware/spine-editor

Again, thanks for putting in so much time to identify the issue and even provide a (temporary) fix!
Аватара пользователя

  • Сообщения: 2108

Вернуться в Bugs