Hey,

Our programmers are struggling, because we have different behaviour in Unity than in Spine regarding IKs. I'm attaching a message from our team. I hope you can help us.

We have a problem with flipping IK bones on Unity’s side, when a parent’s bone scale is flipped either in X or Y axis. Previously we were working on Unity version 2020.1.7 with Spine version 4.0 and everything worked fine. This error started occurring after updating Unity to 2021.3.22 and Spine to 4.1.

It is most noticeable on IK’s that are controlling the character's pupil positions.

Scenario 1 (working): No flip on any bone is present - everything works correctly on both Spine and Unity’s side.

Scenario 2 (error): Characters are set up sitting with a negative scale on the Y axis in the head bone. It is done so that character’s head is positioned correctly:


(no negative scale)


(negative scale)

This change causes pupil IKs to flip (but only on Unity’s side).

Do you know what could be the reason for this or where should we look for the solutions?

Thank you!

    Related Discussions
    ...

    trafcio This error started occurring after updating Unity to 2021.3.22 and Spine to 4.1.

    @trafcio Sorry to hear you're encountering problems!

    Which exact version of the spine-unity runtime (name of the unitypackage, also listed in Assets/Spine/version.txt or in Package Manager) are you using?
    Which version of the Spine Editor?

    How exactly are you setting the Bone scale? Do you apply it via code each frame (e.g. after the animation is applied), or do you apply it only once (as your animations are not overriding bone scale via keys)?

    Thank you for your answer.

    Package version: spine-unity-4.1-2023-04-05
    Spine Editor: 4.1.23

    In this case, we are not setting Bone scale from code. The negative scale for head Bone is applied in the animation itself via keys.

      trafcio In this case, we are not setting Bone scale from code. The negative scale for head Bone is applied in the animation itself via keys.

      Thanks for getting back to us. Could you then please send us both your problematic Spine project and a minimal Unity project which demonstrates the issue? You can send it as a zip package to contact@esotericsoftware.com as usual, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at what's going wrong.

      Great. I've just sent you an email 🙂

      @trafcio Thanks for sending the reproduction projects, we received everything and can now reproduce the issue. We will get back to you here on the forum as soon as we've figured out what's going wrong. Thanks for reporting and sorry for the troubles!

      @trafcio The problem seems to be that your installation of the spine-unity runtime was not a clean version of the spine-unity-4.1-2023-04-05 package. Re-importing the same spine-unity-4.1-2023-04-05.unitypackage package shows changes in the IKConstraints.cs file in Spine/Runtime/spine-csharp/. After the package was imported the issue was immediately resolved.

      While re-importing the same spine-unity-4.1-2023-04-05 package, you could consider updating to the latest version of the spine-unity package in one go thereafter to save you some potential other issues which have been fixed in the meantime.

      @Harald thanks for the info. Everything's working great now!

      We tried spine-unity-4.1-2023-04-05 and the issue still persists. However, the subsequent packages have resolved our problem.

      Sorry we didn't check that earlier. We have a bunch of custom code in Spine, so we're usually a bit hesitant to update. But we'll make sure to check more frequently from now on.

        trafcio Sorry we didn't check that earlier. We have a bunch of custom code in Spine, so we're usually a bit hesitant to update. But we'll make sure to check more frequently from now on.

        Glad to hear it helped, no worries!

        It might be easiest for you to just use a clean separate Unity project with only the latest spine-unity runtime installed for checking any bugs that occur in your main project. Then you can check in advance if the latest package resolves your import issues, without requiring to update the runtime and re-applying your modifications.