Re-export your skeleton data
Note: Json and binary skeleton data files exported from Spine 3.7 will not be readable by the Spine-Unity 3.8 runtime!
The skeleton data files need to be re-exported using Spine 3.8.
If you have many projects, we suggest automating exporting your project files:
Export - Spine User Guide: Command line
For example, here is a script we use to export all the Spine example projects and to create texture atlases:
spine-runtimes/export.sh at 3.8
Recommended upgrade steps for upgrading from 3.7 to 3.8:
-
Create a backup of your 3.7 project to be on the safe side.
-
Close all open scenes and create a new blank scene, and have nothing selected. This is to make sure there are no active Spine objects.
-
Note any custom changes you made to your Spine-Unity runtime.
-
Delete your old "Spine" and "Spine Examples" folders.
-
Close the project and Unity.
-
Replace the old exported 3.7 skeleton assets with their re-exported 3.8 counterparts.
-
Open Unity and your project again.
-
Import the latest Spine-Unity 3.8 unitypackage.
Adapting your code to 3.8 API changes
For notable changes to the API, please see the Changelog, sections C#
and Unity
spine-runtimes/CHANGELOG.md at 3.8
Some methods have been renamed or replaced in 3.8.
If you receive compile errors from your own code because of using renamed and no-longer existing methods, the following steps will help to quickly make your own code compatible again:
-
Replace any usage of Skin.AddAttachment()
with Skin.SetAttachment()
.
-
Replace any usage of Skin.FindAttachmentsForSlot()
and Skin.FindNamesForSlot()
with the combined Skin.GetAttachments(int slotIndex, List<SkinEntry> attachments)
method:
// replace this code:
List<Attachment> attachments = new List<Attachment>();
List<string> names = new List<string>();
skin.FindAttachmentsForSlot(slot, attachments);
skin.FindNamesForSlot(slot, names);
string name = names[index];
string attachment = attachments[index];
// with this code:
List<Skin.SkinEntry> entries = new List<Skin.SkinEntry>();
skin.GetAttachments(slot, entries);
string name = entries[index].Name;
string attachment = entries[index].Attachment;
-
PoseSkeleton()
and PoseWithAnimation()
extension methods were removed. As a replacement you can use AnimationState.ClearTrack(0);
followed by var entry = AnimationState.SetAnimation(0, animation, loop); entry.TrackTime = time
to achieve similar behaviour.
-
Replace usage of Attachment.GetClone()
with Attachment.Copy()
and usage of MeshAttachment.GetLinkedClone()
with MeshAttachment.NewLinkedMesh()
.
-
Replace usage of Attachment.GetClone(bool cloneMeshesAsLinked)
with Attachment.GetCopy(bool cloneMeshesAsLinked)
-
SkeletonDataAsset.atlasAssets
is now an array of the base class AtlasAssetBase
instead of SpineAtlasAsset
, which provides an IEnumerable<> Materials
instead of a List<> materials
. So replace any access via atlasAsset.materials[0]
with atlasAsset.Materials.First()
and add a using System.Linq;
statement at the top of your file.
-
Replace using statements of using Spine.Unity.Modules.AttachmentTools;
with using Spine.Unity.AttachmentTools;
. You can remove using Spine.Unity.Modules;
statements when a using Spine.Unity
statement is already present in the file.
For a complete list of changes, see the spine-runtimes/CHANGELOG.md at 3.8.
Timeline Support has been moved to a separate UPM (Unity Package Manager) Package
See the changelog for more info:
spine-runtimes/CHANGELOG.md at 3.8
Changes of default values
-
SkeletonMecanim
's Layer Mix Mode
now defaults to MixMode.MixNext
instead of MixMode.MixAlways
. Consider this when creating new SkeletonMecanim
instances, existing ones are not affected. Note: for a short time, the default value was changed to MixMode.SpineStyle
. MixMode.SpineStyle
is now renamed to MixMode.Hard
.
BlendModeMaterialAsset
and it's instance Default BlendModeMaterials.asset
now have Apply Additive Material
set to true
by default in order to apply all blend modes by default.
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! 🙂