- Düzenlendi
[Spine]how to optmize the exporting of assets?
Hi,
as the title suggests, I'm dealing with the following scenario/setup:
- I'm using the PhotoshopToSpine script to export images;
- I export from a main character .psd file that basically is a WIP, meaning that it gets updated with new outfits/props from time to time;
I've got two options:
1- hiding previously exported assets > the script will write a new JSON that will list only the visible assets;
2- Leaving everything visible > over time, it may take forever for the script to export every asset again and again;
Option #1 seems to be the most practical, although I'm not sure how to handle/combine multiple JSONs in Unity (not to mention it will lead to having as many JSONs as -say- the amount of outfits, which sounds sort of insane).
Option #2 -on the other hand- seems to be most time consuming, since we'll be exporting previously exported images over and over again;
What do you suggest? Am I missing something on how the PTS script works?
And what about the atlas? Wouldn't be crazy to export HUGE atlas files that include everything (character + outfits)?
Thanks in advance
Option 1 is probably the way to go. You don't need to combine multiple JSON's in Unity since the JSON you export from Photoshop is not meant to be used in Unity. Instead you would import the JSON from Photoshop into Spine, set up your skeleton, possibly animate, and then export from Spine. The data exported from Spine is then imported into Unity. If you then decide to add more to your skeleton, you will then need to export that from Spine again, and re-import in Unity.
Note that the JSON from Photoshop can be imported into Spine on top of an existing skeleton.
Thanks, Søren.
Yes, that's how I "update" my skeleton, and there probably was a misunderstanding with my coder: sorry about that.
One last question, if you don't mind: what about the Atlas?
Can you imagine exporting an atlas including the main character and +99 outfits? I mean, is there any way to break the atlas into smaller parts? Or is that irrelevant, anyway?
Thanks again!
If your images fit on a single atlas page (a typical maximum is 4096x4096), or can be separated so images drawn together are on the same pages, then there's no problem packing them into a single atlas. Otherwise you may want to look at distributing individual images in your app and packing an atlas at runtime with only the images needed based on the app specific information, such as the character's current equipment/abilities, the animation that will be played, the level, etc.
Could you clarify how to separate images drawn together to be on the same atlas pages when we export them for Unity? Thanks.
Thanks Nate.
However, there is a problem. Skeleton JSON expects the attachment to be found in:
"{ "name": "wing_lx", "bone": "wing_lx", "attachment": "doll/wings/wing_single_lx" },
while in atlas, the attachment path looks like this:
wings/wing_single_lx
rotate: true
xy: 1422, 1286
size: 354, 758
orig: 354, 758
offset: 0, 0
index: -1
So atlas basically excludes the "doll" folder from the file path.
I suspect it's due to the file structure used during spine import?
I've been using the "Texture Packer" option to export both the skeleton and the outfit for testing.
Thanks
DarkTI yazdıCould you clarify how to separate images drawn together to be on the same atlas pages when we export them for Unity? Thanks.
You can control which images are grouped together on the same atlas page by organizing your images into subfolders:
Texture Packing - Spine User Guide: Folder structure
@TheWorst, likely you have your images something like this:
images/doll/wings/wing_single_lx.png
If you run the texture packer on the images
folder than the path in the atlas will be doll/wings/wing_single_lx
. It looks like you are instead running the texture packer on the doll
folder, which is why you get paths like wings/wing_single_lx.png
.
Note if you need to change your images folder you can use find and replace to fix up your attachment names:
Tree - Spine User Guide: Find and Replace
It is also shown in the video on that page at 5:24:
https://youtu.be/guZ-zdr4IDw?t=324
Oh, you mentioned you are doing the packing as part of the JSON or binary data export? In that case it should pack the images folder and paths in the atlas should match the names of the attachments, as they do in the Spine editor.