- 已编辑
Switching between separate Spine files
Hi all,
Is it at all possible to switch from one Spine file to another seamlessly with code?
I have 2 Spine files for one character - I had to split them up because in the 2nd one we make use of a lot of PNG sequences.
In those two files, we make use of the same static pose so my thought was to transition to the other file on the same pose not to cause any jump when doing so.
Any ideas?
I might be missing the context of your skeleton here, but is there a reason why you export your skeleton as PNG image sequences and not via Export
- data
- binary
? This would solve your problem of more animations leading to more images exported, and to be loaded.
Harald :
Hi Harald,
I have exported all my animations as JSON files and not PNG sequences. I have PNG sequences in some of the animations that were created.
What is the difference between Binary and JSON?
(pls excuse my noobness)
supsupsup :What is the difference between Binary and JSON?
supsupsup :I have exported all my animations as JSON files and not PNG sequences. I have PNG sequences in some of the animations that were created.
By PNG sequences, do you mean that
- a) you are using a sequence of PNG files and switch them as attachment images in Spine (on the input side)?
or - b) that Spine is creating a lot of atlas pages when exporting (creating a lot of PNG files on the output side)?
Hi Harald,
B, because of the PNG sequences used (the character moves in such a way that it cant be reproduced with Spine), when exporting Spine exports many PNG files
You will need the images for your PNG sequences at some point, even if you use multiple skeletons. I would suggest keeping a single skeleton. If you want to load all your images at once, you might as well use a single atlas. If you want to load only only a portion of your images at once, you could consider packing them into multiple atlases. You can load Spine skeleton data without having some (or all) of the images loaded. To do that you'd provide your own AttachmentLoader. You can read about how that works here:
Loading Skeleton Data - Spine Runtimes Guide: JSON and binary data
The idea is that instead of using AtlasAttachmentLoader, your own loader prepares only some (or none) of the attachments for rendering. Before you render the attachments that have not been prepared yet, you'll need to prepare them in the same way that AtlasAttachmentLoader does. Eg, if using spine-unity (or spine-csharp):
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-csharp/src/Attachments/AtlasAttachmentLoader.cs
I forgot to reply on this thread, I mentioned the above to our devs - will revert back if we have any other questions.
Thanks so much for always taking the time to get back to us!