• RuntimesUnity
  • Spine-Unity 4.1 to 4.2 Upgrade Guide

As Spine 4.2 has just been released, you can find the officially compiled Upgrade Guide for version 4.2 below.

Re-exporting skeletons and upgrading the spine-unity runtime files
Please check out the spine-unity documentation sections below:
spine-unity Runtime Documentation: Updating the spine-unity Runtime
spine-unity Runtime Documentation: Updating an Extension UPM Package
They describe necessary steps like re-exporting your skeletons, upgrading across multiple spine-unity versions and how to safely upgrade the spine-unity runtime files.

Adapting your code to 4.2 API changes
For notable changes to the API, please see the Changelog, sections C# and Unity
https://github.com/EsotericSoftware/spine-runtimes/blob/4.2/CHANGELOG.md#c-2

Some methods have been renamed or replaced in 4.2.
If you receive compile errors from your own code because of using renamed and no-longer existing methods, the following points from the changelog will help to perform the required steps to your own code to make it compatible again:

  1. Replace any occurrances of TrackEntry.AttachmentThreshold with TrackEntry.MixAttachmentThreshold.

  2. Replace any occurrances of TrackEntry.DrawOrderThreshold with TrackEntry.MixDrawOrderThreshold.

  3. Replace any occurrances of Skeleton.UpdateWorldTransform() with Skeleton.UpdateWorldTransform(Skeleton.Physics.Update). Note: If you are certain that a subsequent call to Skeleton.UpdateWorldTransform(Skeleton.Physics.Update) follows in the same frame, you can pass Skeleton.Physics.Pose as argument instead of Skeleton.Physics.Update.

  4. Replace any occurrances of SkeletonGraphicRenderTexture.quadRawImage with quadMaskableGraphic, change the type from RawImage to MaskableGraphic.

Changes in behaviour from 4.1 to 4.2
For a full list of changes in behaviour, please again see the Changelog, sections C# and Unity
https://github.com/EsotericSoftware/spine-runtimes/blob/4.2/CHANGELOG.md#c-2

  • MeshGenerator received a new optimization option to avoid rendering fully transparent attachments at slot alpha 0 by default. Comment out #define SLOT_ALPHA_DISABLES_ATTACHMENT in MeshGenerator.cs to revert to previous behaviour. You may only need this option disabled when utilizing a custom shader which uses vertex color alpha for purposes other than transparency.

  • SkeletonGraphic Materials: Since the addition of new material sets for the CanvasGroupCompatible parameters, the default SkeletonGraphic materials all have CanvasGroup Compatible disabled. Please assign the respective material from the CanvasGroupCompatible material subdirectory if you want CanvasGroup Compatible enabled at your SkeletonGraphic. Note that you can use the new Detect Settings and Detect Material buttons to automatically assign the suitable materials.

You can download the new unitypackages from the download page: spine-unity Download

If you find anything that should be noted or added to the guide, please do not hesitate to post it below so that we can make upgrading as easy and painless as possible for everyone.

We hope that you like the new Spine release and are able to create even more incredible games with it! 🙂

Related Discussions
...
Harald 置顶此帖
13 天 后

One additional minor breaking change has just been introduced at the example component SkeletonGraphicRenderTexture to fix a recent issue.

Additional step to make your own code compatible again when accessing the RawImage created by SkeletonGraphicRenderTexture:

  • Replace any occurrances of SkeletonGraphicRenderTexture.quadRawImage with quadMaskableGraphic, change the type from RawImage to MaskableGraphic.

We have updated the above posting accordingly to include this change in the list.

3 个月 后

Do I need to re export all spine files from 4.0 to 4.2 after upgrading spine unity from 4.0?

I've replied on your other forum thread, please don't post the same question multiple times.

All your links lead to the Overview page. Could you provide more detailed directions to the specific information?

    acai Sorry, we split the documentation pages so the links did not work properly. Fixed now!

    Thank you very much for your prompt response!

    15 天 后

    First of all, thanks for 4.2 and all its amazing features! 🙏

    I just updated to 4.2-2024-08-08 and am getting the following compiler error:

    Assets\Spine\Runtime\spine-csharp\SpringConstraint.cs(38,34): error CS0535: 'SpringConstraint' does not implement interface member 'IUpdatable.Update(Skeleton.Physics)'

    I'm guessing / wondering if this is because we're beyond Unity 2023.1? We're on 2023.2.7f1.

    If it is because of that, do you know when you'll be supporting newer Unity versions? If it's not and something else is going on, let me know!

    For now I've just added this bit to that script to get things at least running again (not sure about any side effects yet):

    public void Update(Physics physics) { }

    It would help if I followed instructions 🙃 I did an in-place update instead of a full proper delete-and-reimport update. Sorry for the false alarm!