Recommended upgrade steps for upgrading from 3.6 to 3.7:
- 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. Make a backup if it was changed.
- Delete your old "Spine" folder.
- Import the latest Spine-Unity 3.7 unitypackage.
- Optionally: close the project and Unity, and open it again.
- If you were using SkeletonAnimator in code, change it to "SkeletonMecanim". See more detailed changes below.
Json skeleton data exported from Spine 3.6 will be readable with the 3.7 runtime.
Binary skeleton data needs to be re-exported using Spine 3.7.
Notable changes:
- SkeletonMecanim
SkeletonAnimator
has been renamed to SkeletonMecanim
This is to make it easier to identify as a glance, and to maximize code completion utility when using one and not the other.
Existing prefabs and scenes should stay intact. But code needs to be updated to use "SkeletonMecanim" instead of "SkeletonAnimator".
Note this is NOT SkeletonAnimation.
SkeletonAnimation is still SkeletonAnimation.
Only SkeletonAnimator was renamed to SkeletonMecanim.
Those are different components.
- Shaders
Spine-Unity's basic shaders now allow straight-alpha textures by checking the "Straight Alpha Texture" checkbox in the Material inspector. This will compile the shader as a shader variant (keyword _STRAIGHT_ALPHA_INPUT
).
Spine/SkeletonGraphic (Premultiply Alpha)
was renamed to Spine/SkeletonGraphic
Spine/SkeletonGraphic Tint Black (Premultiply Alpha)
was renamed to Spine/SkeletonGraphic Tint Black
The old dedicated straight alpha shaders were removed.
Runtime and Editor, and Assembly Definition
If you want to utilize the new folder arrangement with the recommended assembly definition files, you can delete your old Spine-Unity runtime folder and import the latest unitypackage.
As usual, make sure you back up your project in case you lose some changes or something breaks in the process.
SpineAtlasAsset
AtlasAsset
has been renamed to SpineAtlasAsset
. This clarifies that the atlas source is a Spine/libGDX atlas, rather than something else. Coming soon is the option to use Unity's SpriteAtlas for packing, as well as other atlas source options.
Existing fields on components, prefabs and assets should remain intact.
Skeleton.FlipX/FlipY is now Skeleton.ScaleX/ScaleY
The Skeleton class now has ScaleX and ScaleY which replaces FlipX and FlipY.
Here is a summary to get an equivalent of the old behavior:
// To get the value
bool flipX = skeleton.ScaleX < 0;
// To set the value.
skeleton.ScaleX = flipX ? -1f : 1f;
the FlipX/FlipY properties are in the beta and marked as Obsolete, but will be removed on release.
SetPosition is now SetLocalPosition
The Bone.SetPosition
extension was renamed to Bone.SetLocalPosition
for extra clarity.
SkeletonDataModifiers and BlendModeMaterials asset
SkeletonDataAssets now have an extensible asset system for doing extra processing to SkeletonData after it is loaded. This is called SkeletonDataModifier assets.
One of these is the BlendModeMaterials asset. This asset type uses replacement Materials for attachments in slots that have special blend modes. It does this by generating the necessary Materials using the template materials stored in the asset.
It generates Materials needed for Screen and Multiply (and optionally, Additive) blend mode slots, then assigns those generated materials to the Attachments that are defined in a slot with special blend modes.
Compared to 3.6, BlendModeMaterials assets stand as a more performant solution that better-handles multi-texture cases compared to the old SlotBlendModes
component. SlotBlendModes is still useful for when you need to do instance-level material customization, and will not be removed from the runtime. However, in most basic cases, the BlendModeMaterials asset will be all you need.
This new module comes with a default "Default BlendModeMaterials" asset, as well as Materials which will work out of the box. To use it, just add this "Default BlendModeMaterials" asset to your SkeletonDataAsset's new "Skeleton Data Modifiers" list in the inspector.
If you want more advanced settings, you can duplicate that default asset or create a new one, then set your own custom materials and shaders to use as templates.
If you have multiple slots that share the same blend mode, and multiple attachments that are found in the same atlas, they will share the same generated Material.
As usual, multiple blend modes will cause your rendered skeleton mesh to use multiple Materials. With that comes more draw calls and other associated behaviors that come with multi-material MeshRenderers in Unity.
// MORE TO FOLLOW...
You can download the beta unitypackage now from the download page: Spine Unity Download
For more info on the changes, see : spine-runtimes/CHANGELOG.md at 3.7-beta