• RuntimesUnity
  • Animations (partially/fully) becoming invisible

Hello,

I have a problem and I could not find any explanations for its cause. Basically, I have some objects in Unity which have SkeletonAnimation components. These SkeletonAnimations contain multiple different animations on different tracks.

The problem is that for some objects, playing one animation after another makes some parts of the animation object invisible. To illustrate, there is a bird and its SkeletonAnimation has an idle animation and a fly animation. I play the fly animation sometime after the idle animation loop starts. When the fly animation starts, the bird's wings disappear. The animations do not have a problem when played individually. Does anyone have any ideas as to why this could be happening?

I am using Unity 2022.3.2 and Spine version 4.1.23 on Windows 11.

Thanks in advance!

Related Discussions
...

@fitpighter I'm afraid we need more information to be able to help. This could be a problem with attachment visibility in the setup pose in your Spine project. Are these problematic invisible parts visible when you switch to SETUP mode (from ANIMATE mode) in the Spine Editor?

Do these problems occur if you preview the same two or three animations in the Spine Editor via the Preview view (ALT+R)? If so, then the problem is located in the Spine project and likely related to attachment keys or visibility during the setup pose. If not, it might be a problem on the Unity side.

Which exact version of the spine-unity runtime (name of the unitypackage, also listed in Assets/Spine/version.txt) are using in your project? If you're not using the latest version, please have a try whether updating the package resolves your issue:
https://esotericsoftware.com/spine-unity-download

If the problem could not be resolved by the above, could you please send us a minimal Unity project which still shows this issue? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at it.

Hello again,

Thank you for your response. I have managed to solve the problem by resetting the state (skeletonAnimation.ClearState()) before playing an animation (skeletonAnimation.AnimationState.AddAnimation()). I hope this will not cause further problems.

Kind regards.

@fitpighter Thanks for getting back to us. While it might solve one issue, calling skeletonAnimation.ClearState() or skeletonAnimation.AnimationState.ClearTracks() is not recommended since you then don't get mixing between two successive animations (no smooth crossfade transition from one animation to another). Additionally, it is wasting CPU cycles for the clear operation which should not be necessary before adding an animation. We would recommend investigating the cause of the problem.