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()
withSkin.SetAttachment()
. - Replace any usage of
Skin.FindAttachmentsForSlot()
andSkin.FindNamesForSlot()
with the combinedSkin.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()
andPoseWithAnimation()
extension methods were removed. As a replacement you can useAnimationState.ClearTrack(0);
followed byvar entry = AnimationState.SetAnimation(0, animation, loop); entry.TrackTime = time
to achieve similar behaviour. - Replace usage of
Attachment.GetClone()
withAttachment.Copy()
and usage ofMeshAttachment.GetLinkedClone()
withMeshAttachment.NewLinkedMesh()
. - Replace usage of
Attachment.GetClone(bool cloneMeshesAsLinked)
withAttachment.GetCopy(bool cloneMeshesAsLinked)
-
SkeletonDataAsset.atlasAssets
is now an array of the base classAtlasAssetBase
instead ofSpineAtlasAsset
, which provides anIEnumerable<> Materials
instead of aList<> materials
. So replace any access viaatlasAsset.materials[0]
withatlasAsset.Materials.First()
and add ausing System.Linq;
statement at the top of your file. - Replace using statements of
using Spine.Unity.Modules.AttachmentTools;
withusing Spine.Unity.AttachmentTools;
. You can removeusing Spine.Unity.Modules;
statements when ausing Spine.Unity
statement is already present in the file.
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
'sLayer Mix Mode
now defaults toMixMode.MixNext
instead ofMixMode.MixAlways
. Consider this when creating newSkeletonMecanim
instances, existing ones are not affected. Note: for a short time, the default value was changed toMixMode.SpineStyle
.MixMode.SpineStyle
is now renamed toMixMode.Hard
. BlendModeMaterialAsset
and it's instanceDefault BlendModeMaterials.asset
now haveApply Additive Material
set totrue
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!
