inZania

I'm having a couple of different problems with my Spine project when I import it into Unity.

In my Spine project, I'm adding placeholder assets for the equipment which I would like to be able to swap out using the Sprite Attacher script. (n.b., I also tried using empty nodes instead of placeholders, but settled on placeholders as a way to confirm it looks right):


I then import the project into Unity and use the Sprite Attacher script to replace the placeholder *with the exact same asset*. But the Sprite Attacher mangles the asset. Here, I've added the "palm" (hand) of the glove as an asset onto the scene to show how it should look. But as you can see, the attached sprite has the wrong transparency, rotation and scale:


Here's a zip of my Spine project: http://inzania.com/temp/mg/spine_attach.zip
I've tried playing with every possible setting I can think of. For example, I changed the Filter Mode on the sprite from Compressed to every other setting in attempts to fix the transparency issues. I've watched all the sprite attacher videos, and tried adding a Packing Tag since I saw someone do that. Nothing has had any effect.

Next, I'm also having a problem with animations. If I hit the Unity Play button with the character already in the "run" animation, everything is fine. But if I use the dropdown to switch into the "run" mode, the left arm (our left, not the character's left) clips behind his body. Here's a video:
http://inzania.com/temp/mg/spine_running.mov

Thanks for your help!
inZania
  • Сообщения: 3

Pharan

For an equip system, the Sprite Attacher is not the way to go. You'll have to handle too many extra cases just to get it simply working.
Other people have done this already using Skin Placeholders in the editor and dynamic Skins in Unity.
Parts defined in Spine itself have the benefit of storing position and rotational offsets that Sprite Attacher does not.

See the sample unitypackage at the bottom of this post: Costumizable itens with more than one view/slot - UNITY

Also try searching the forums for this. People have been doing this already.


The transparency issues you experienced has to do with this: Premultiply Alpha
The animation issue happens because you need to be explicit (in code) about what you want to happen when animations switch. By default, it does nothing that was not defined in the animation data.
Particularly, if the draw order was changed in one animation, the next animation will not reset the draw order. You either have to key that, or call skeleton.SetSlotsToSetupPose() when you change animations.
I've also updated the FAQ here that may be relevant for you: Noteworthy Spine-Unity Topics
Аватара пользователя
Pharan
  • Сообщения: 5366


Вернуться в Unity