• RuntimesUnity
  • Animation in build work only partly, but in editor everything is cool

Hello, everyone 🙂

I use spine 4.1
Unity ver 2022.3.17f1
I use Universal Render Pipeline

Some of my animations include the attachment keys.

For example, I shrink the body of a chicken and key it in animation.

When I export it to Unity everything works the proper way,

BUT

when I Build the game, the attachment key completely doesn't work (chicken stays unshrink), while all the other keys (bone keys) still work properly

Maybe somebody knows how to solve this issue?

Thank everyone for the help!


Related Discussions
...

It sounds like the issue you're experiencing is related to attachment keys not functioning correctly in the build version of your game, while they work fine in the Unity editor. Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Check the Preview in Unity: Ensure that the animation looks correct in the Preview section when the SkeletonDataAsset is selected in the Inspector window. If it looks right in the preview, the issue might be related to the build process or runtime.

  2. Verify Export Settings: Make sure that Animation Cleanup is disabled when exporting your skeleton. This setting can remove keys identical to the setup pose, which might cause issues when layering animations.

  3. Attachment Visibility: Ensure that the problematic attachments are visible in the setup pose in your Spine project. Switch to SETUP mode in the Spine Editor to verify this.

  4. Check Unity Project Settings: Verify the settings in Project Settings - Editor - Enter Play Mode Settings. Setting everything to "fully reload" might help create the same situation as in your build.

  5. Update Spine-Unity Runtime: Ensure you are using the latest version of the spine-unity runtime. If not, update the package and see if the issue persists.

  6. Minimal Unity Project: If the problem persists, create a minimal Unity project that demonstrates the issue and send it to Esoteric Software for further assistance. This can help identify if the problem is specific to your project setup.

If none of these steps resolve the issue, it might be helpful to add a second (identical) attachment key slightly after the first one in the animation. This workaround has been suggested for similar issues in the past.

For further reference, you can check the spine-unity Runtime Documentation: Life cycle.

I`ve tried everything mentioned, except the minimal unity project yet.
Unfortunately, nothing had helped. =(

@lunituni666 Sorry to hear. Could you please then 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.

    Harald
    I found the way to deal with the problem =) thx for your support!

    The part for anyone who ever met the same problem ->

    I used the AnimationReferenceAsset for setting the animation instead of simply using the name of the animation
    I was loading all AnimationReferenceAsset to some kind of container using Addressables, injected that container, and got all AnimationReferenceAsset that I wanted for the entity.

    I solved the problem using string names directly instead of the previous way.

    @lunituni666 Please note that using an AnimationReferenceAsset or caching an Animation reference is recommended over setting animations via AnimationState.SetAnimation(0, animationString).

    Your problem description sounds as if you've either assigned an AnimationReferenceAsset belonging to a different SkeletonDataAsset (like assigning an idle AnimationReferenceAsset from Skeleton B to Skeleton A), or as if something else has been cached incorrectly.