RubberDuckCoder

Hello,

so I have a Spine animation where a certain part is a sprite sheet animation, when it is exported it is all in the same atlas. Now when I try to use it in Unity on my SkeletonAnimation instead of the single sprite the whole atlas is shown. Is there something in Spine or Unity to get this to work?
RubberDuckCoder
  • Posts: 8

Harald

RubberDuckCoder wrote:I have a Spine animation where a certain part is a sprite sheet animation
Could you please explain in more detail how you have set up this sprite sheet part on the Spine Editor side?
RubberDuckCoder wrote:.. when I try to use it in Unity on my SkeletonAnimation instead of the single sprite the whole atlas is shown
How do you currently use the sprite sheet on your SkeletonAnimation GameObject? Do you have a separate Sprite or a quad GameObject where you have assigned the atlas texture at?

In case I understood your description correctly: We would suggest to set up everything on the Spine Editor side, including switching sprites. When you then export the project as a single skeleton and atlas texture, you can import it as a single SkeletonAnimation object which ensures that it looks just as in the Spine Editor. Or do you need to separate the sprite sheet animation part for some reason?
User avatar
Harald

Harri
  • Posts: 1524

RubberDuckCoder

I did as you suggest, everything was set up in Spine, including the sprite swap, then exported with packing type "rectangles" and imported in Unity. I attached two images (both a bit distorted, the original has color and transparent background), one is the sprite atlas which looks correct, the other is when I preview an animation in Unity, but the same happens in-game too. The wings should be swapped out and the animation works, but it is not only the area of the specific wing sprite shown, but the whole atlas. Do I have to make some adjustments in Unity when importing or use the sprite editor to slice the image? I am using Spine for other animations and they work fine, this is the first time we have a sprite swap in a Spine animation.

atlas.png


unity.png
You do not have the required permissions to view the files attached to this post.
RubberDuckCoder
  • Posts: 8

Harald

Thanks for the detailed description. If it plays back the animation corretly in the Spine Editor, then no additional steps should be necessary for sprite swapping, the spine-unity runtime should take care of everything for you.

Which version of Spine are you using, and which version of the spine-unity runtime (name of the unitypackage)?
What version of Unity are you on?
User avatar
Harald

Harri
  • Posts: 1524

RubberDuckCoder

Hello,

we are using Spine 3.8.79 and for Unity spine-unity-3.8-2019-12-23.unitypackage.
The Unity version is 2019.2.11f1.
RubberDuckCoder
  • Posts: 8

Harald

The versions you are using are not expected to cause any problems.

Could you please send us your Spine project (including the image files or at least some placeholders) as a zip package, to contact@esotericsoftware.com. Then we can have a look a what goes wrong.
User avatar
Harald

Harri
  • Posts: 1524

RubberDuckCoder

Ok, done. Thanks for your help.
RubberDuckCoder
  • Posts: 8

Harald

Thanks for the reproduction package, we received everything and could now see your problem.
However, when we re-exported the project from Spine, we did not receive the same problem.
Could you please show us two screenshots showing your Export settings and Texture Packer Settings that you used to export the attached files?
User avatar
Harald

Harri
  • Posts: 1524

RubberDuckCoder

Hello, please find our settings here :
Screenshot_Export_Spine_Fish_02.jpg
Screenshot_Export_Spine_Fish_01.jpg
You do not have the required permissions to view the files attached to this post.
RubberDuckCoder
  • Posts: 8

Harald

Thanks for sharing the export settings.

It seems as if the export issue is a bug related to Spine version 3.8.79 (incorrectly stripping some whitespace at a mesh), after upgrading to Spine 3.8.81, the problem no longer occurs.

Regarding your setup: Please note that you should not use meshes in form of a quad for your wings, you could as well use a normal Region Attachment, which would allow for automatic whitespace stripping. When you currently export your atlas textures, it contains lots of unnecessary whitespace due to using Mesh Attachments. Unless you are planning on editing the meshes later to fit the image, then of course ignore the lines above.
User avatar
Harald

Harri
  • Posts: 1524

RubberDuckCoder

Thanks, that fixed it.

I already have another question up at Bounding boxes not flipping correctly :)
RubberDuckCoder
  • Posts: 8

Harald

Glad to hear the fix resolved it, thanks for letting us know!
User avatar
Harald

Harri
  • Posts: 1524


Return to Unity