• RuntimesUnity
  • Spine animation doesn't play in Unity

  • تم التحرير

Hi, we have an issue where a spine won't play in Unity. Our animator exported the json and atlas data, we created a SkeletonData asset, added the json and atlas data into it and dragged it into the scene to make a SkeletonAnimation component.

In Spine the animation is only changing the mask 'a keyframed mask animation.' It appears completely static in Unity.

How should I debug this kind of issue?

Here is the json:

{
"skeleton": {
	"hash": "Y+CUWpEzJeg",
	"spine": "4.0-from-4.1.24",
	"x": -50,
	"y": -49,
	"width": 100,
	"height": 98,
	"fps": 60,
	"images": "",
	"audio": "C:/unityProjects/aEye/sgj-game/Assets/Animation/Spine/cooldownPick"
},
"bones": [
	{ "name": "root" },
	{ "name": "circleYellow", "parent": "root" },
	{ "name": "circleRed", "parent": "root" },
	{ "name": "circleRed2", "parent": "circleRed" }
],
"slots": [
	{ "name": "circleYellow", "bone": "circleYellow", "attachment": "circleYellow" },
	{ "name": "mask", "bone": "circleRed", "attachment": "mask" },
	{ "name": "circleRed", "bone": "circleRed2", "attachment": "circleRed" }
],
"skins": [
	{
		"name": "default",
		"attachments": {
			"circleRed": {
				"circleRed": { "width": 100, "height": 98 }
			},
			"circleYellow": {
				"circleYellow": { "width": 100, "height": 98 }
			},
			"mask": {
				"mask": {
					"type": "clipping",
					"end": "mask",
					"vertexCount": 6,
					"vertices": [ -1.1, -0.32, -0.38, 65.79, -71.05, 67.95, -68.17, -85.41, 96.97, -88.29, 86.63, 76.6 ],
					"color": "ce3a3aff"
				}
			}
		}
	}
],
"animations": {
	"animation": {
		"slots": {
			"mask": {
				"rgba": [
					{ "time": 4.9833, "color": "fffffffe" },
					{ "time": 5, "color": "ffffff00" }
				]
			}
		},
		"deform": {
			"default": {
				"mask": {
					"mask": [
						{
							"offset": 10,
							"vertices": [ -88.45766, 30.04678 ]
						},
						{
							"time": 1.1667,
							"vertices": [ 0.06946, 0, 0.1131, 0, 14.28335, -0.08391, 13.99904, 38.2644, -19.23056, 39.69092, -4.71561, -77.59569 ]
						},
						{
							"time": 2.5,
							"vertices": [ 0.06946, 0, 0.1131, 0, 14.28335, -0.08391, 13.99904, 38.2644, -79.32556, 7.59046, -86.07612, -139.18234 ]
						},
						{
							"time": 3.7667,
							"vertices": [ 0.06946, 0, 0.1131, 0, 71.67332, 19.50159, -22.95379, 100.59898, -187.94452, 91.20094, -155.8759, -77.96756 ]
						},
						{
							"time": 4.9833,
							"vertices": [ 0.06946, 0, 0.1131, 0, 71.67332, 19.50159, 45.87299, 187.82863, -119.11774, 178.43059, -87.04912, 9.26208 ]
						},
						{
							"time": 5,
							"vertices": [ 0.34728, 0, 0.56552, 0, 71.41675, -0.41954, 69.99522, 191.32199, -96.15282, 198.45462, -86.43211, 30.88588 ]
						}
					]
				}
			}
		}
	}
}
}
    Related Discussions
    ...

    boyanbotev This JSON data indicates that your skeleton data was exported from Spine 4.1.24 to Spine 4.0 format. Skeleton data files exported for a different version of the editor than the one you are using can only be used to downgrade the Spine project version, not at runtime.
    Is the version of the spine-unity runtime you are using 4.0? If so, import the JSON data once into Spine 4.0 and re-export the skeleton.

    The need to match the editor version to the runtime version is explained in the following section of the Spine User Guide: https://esotericsoftware.com/spine-versioning#Synchronizing-versions

    Dear Misaki, thank you for your message and I'm sorry we've been slow in getting back (Animator is busy with her day job).
    We are actually using Package version: spine-unity-4.1-2023-11-28.unitypackage
    it says 'This Spine-Unity runtime works with data exported from Spine Editor version: 4.1.xx'

    I assume we have to try exporting in 4.1.2, so our animator will try this.

      boyanbotev We are actually using Package version: spine-unity-4.1-2023-11-28.unitypackage
      it says 'This Spine-Unity runtime works with data exported from Spine Editor version: 4.1.xx'

      Yes, you need to export from Spine Editor 4.1.xx in format "4.1", not in an earlier version format for down-grading your project like "4.0-from-4.1.24".

      I assume we have to try exporting in 4.1.2, so our animator will try this.

      Yes.

      Many thanks! It works 🙂