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:
-
Replace any occurrances of TrackEntry.AttachmentThreshold
with TrackEntry.MixAttachmentThreshold
.
-
Replace any occurrances of TrackEntry.DrawOrderThreshold
with TrackEntry.MixDrawOrderThreshold
.
-
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
.
-
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! 🙂