• Unity
  • Spine-Unity 4.0 to 4.1 Upgrade Guide

  • تم التحرير
Related Discussions
...
  • تم التحرير

As Spine 4.1 has just been released, you can find the officially compiled Upgrade Guide for version 4.1 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.1 API changes
For notable changes to the API, please see the Changelog, sections C# and Unity
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/CHANGELOG.md#c-2

Some methods have been renamed or replaced in 4.1.
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. Made SkeletonGraphic.unscaledTime parameter protected. Use the new property UnscaledTime instead.

  2. Removed AttachmentRegionExtensions methods Attachment.SetRegion, MeshAttachment.SetRegion and RegionAttachment.SetRegion(region, update).
    Use attachment.Region = region; if (update) attachment.UpdateRegion() instead.

The following list covers breaking changes to inner parts, which users typically do not access. Most likely these were never used in user code, so no changes should be necessary.

  1. Removed IHasRendererObject interface. Use IHasTextureRegion instead.

  2. Removed RendererObject property from RegionAttachment and MeshAttachment. Use attachment.Region property instead.

  3. Replaced RegionAttachment.UpdateOffset and MeshAttachment.UpdateUVs with Attachment.UpdateRegion. The caller must ensure that the attachment's region is not null.

  4. AttachmentLoader.NewRegionAttachment() and AttachmentLoader.NewMeshAttachment() take an additional Sequence parameter.

  5. VertexAttachment.DeformAttachment property has been replaced with VertexAttachment.TimelineAttachment.

  6. RegionAttachment.ComputeWorldVertices() takes a Slot instead of a Bone as the first argument.

  7. Removed Skeleton.Update(float deltaTime) method. Remove any occurrance of this call, it is no longer necessary.

  8. Removed Slot.AttachmentTime property. Remove any occurrance from your code.

  9. Removed extension method AtlasRegion.GetSpineAtlasRect() parameter includeRotate (with default value true). Most likely this method was never used with includeRotate=false in user code.

  10. AtlasRegion.PackedWidth and AtlasRegion.PackedHeight are swapped compared to 4.0 when packing rotation is equal to 90 degrees.

Changes in behaviour from 4.0 to 4.1
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.1/CHANGELOG.md#c-2

  • SkeletonGraphic OnRebuild callback delegate is now issued after the skeleton has been initialized, before the AnimationState component is initialized. This makes behaviour consistent with SkeletonAnimation and SkeletonMecanim component behaviour. Use the new callback OnAnimationRebuild if you want to receive a callback after the SkeletonGraphic AnimationState has been initialized.

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! 🙂

Hello, I installed this 4.1 in Unity.
Now I need to go back to 4.0
How to uninstall 4.1 to install 4.0? :wounded:

Hello, Misaki has posted instructions here to downgrade a project from 4.1 to 4.0:
4.1.04 FFD keys breaking glitch

To change the Spine Editor version to match, you may do so by seeing the instructions here:
Versioning - Spine User Guide: Choosing a Spine editor version

In order to change your runtimes version, select the 4.0 branch of the Spine runtimes by using the Git checkout process to checkout the 4.0 branch.

Luke wrote

In order to change your runtimes version, select the 4.0 branch of the Spine runtimes by using the Git checkout process to checkout the 4.0 branch.

Please note that you can downgrade the spine-unity runtime just as you upgraded it, following your workflow as described here:
spine-unity Runtime Documentation: Updating the spine unity Runtime
Likely you've installed the spine-unity runtime via the unitypackage and not used git for installation, so please follow the instructions as normally, you are just "upgrading" to a lower version. If anything remains unclear, just let us know.