- Editado
ArgumentException: Skin not found: default
We create a spine object where each skin is a different sprite for different levels of the item like this:
This gets imported into Unity just fine, but when the _SkeletonData.asset file is dragged into the Hierarchy view and Skeleton Graphic (UI) option is selected we get this error:
ArgumentException: Skin not found: default
Parameter name: skinName
Spine.Skeleton.SetSkin (System.String skinName) (at Assets/Spine/Runtime/spine-csharp/Skeleton.cs:396)
Spine.Unity.SkeletonGraphic.Initialize (System.Boolean overwrite) (at Assets/Spine/Runtime/spine-unity/Modules/SkeletonGraphic/SkeletonGraphic.cs:250)
Spine.Unity.Editor.SkeletonGraphicInspector.InstantiateSkeletonGraphic (Spine.Unity.SkeletonDataAsset skeletonDataAsset, Spine.Skin skin) (at Assets/Spine/Editor/spine-unity/Modules/SkeletonGraphic/Editor/SkeletonGraphicInspector.cs:199)
Spine.Unity.Editor.SkeletonGraphicInspector.SpawnSkeletonGraphicFromDrop (Spine.Unity.SkeletonDataAsset data) (at Assets/Spine/Editor/spine-unity/Modules/SkeletonGraphic/Editor/SkeletonGraphicInspector.cs:171)
Spine.Unity.Editor.SpineEditorUtilities+DragAndDropInstantiation.HandleSkeletonComponentDrop (System.Object spawnMenuData) (at Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs:1428)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at C:/buildslave/unity/build/Editor/Mono/GUI/GenericMenu.cs:119)
even though we get that error, the Skeleton Graphic is successfully created. We just need to manually go and change the Initial Skin Name as seen in this picture:
as you can see from the picture, the default skin is not present when there are multiple skins. (It is there though for items that don't use skins).
So there are 2 issues with this:
1) It is annoying to always remember to change Initial Skin Name to something else from default.
2) It makes SkeletonGraphic.NewSkeletonGraphicGameObject method throw an error. Which makes it unusable.
Does anyone know why is this behaving like this?
When you export a skeleton either as .skel or .json file, it always defines a default
skin. The SkeletonGraphic
component therefor assumes it exists in the skeleton data and sets it as the initial skin as the most sensible first choice. The question is: why does your exported data not contain a default skin?
Could you post your .json file here?
This is how the json looks:
{
"skeleton": { "hash": "BeCphBdDUgoayX5jo4ZuR/Z6ti8", "spine": "3.7.91", "width": 130, "height": 158, "images": "./Images/", "audio": "" },
"bones": [
{ "name": "root", "y": 19.15 }
],
"slots": [
{ "name": "Item", "bone": "root", "attachment": "Item" }
],
"skins": {
"default": {},
"1": {
"Item": {
"Item": { "name": "ItemA-01", "width": 115, "height": 115 }
}
},
"2": {
"Item": {
"Item": { "name": "ItemA-02", "y": -28.71, "width": 130, "height": 130 }
}
},
"3": {
"Item": {
"Item": { "name": "ItemA-03", "y": -30.28, "width": 130, "height": 130 }
}
},
"4": {
"Item": {
"Item": { "name": "ItemA-04", "y": -26.1, "width": 130, "height": 130 }
}
},
"5": {
"Item": {
"Item": { "name": "ItemA-05", "y": -14.62, "width": 130, "height": 130 }
}
},
"6": {
"Item": {
"Item": { "name": "ItemA-06", "y": -14.09, "width": 130, "height": 130 }
}
},
"7": {
"Item": {
"Item": { "name": "ItemA-07", "width": 130, "height": 130 }
}
},
"8": {
"Item": {
"Item": { "name": "ItemA-08", "width": 130, "height": 130 }
}
},
"9": {
"Item": {
"Item": { "name": "ItemA-09", "width": 130, "height": 130 }
}
},
"10": {
"Item": {
"Item": { "name": "ItemA-10", "y": 16.7, "width": 130, "height": 160 }
}
}
},
"animations": {
"AutoSpawn": {
"bones": {
"root": {
"scale": [
{
"time": 0,
"x": 1,
"y": 1,
"curve": [ 0.25, 0, 0.75, 1 ]
},
{
"time": 0.2333,
"x": 1.15,
"y": 1.15,
"curve": [ 0.25, 0, 0.75, 1 ]
},
{ "time": 0.3333, "x": 1, "y": 1 }
]
}
}
},
"Idle": {},
"ManualSpawn": {
"bones": {
"root": {
"scale": [
{
"time": 0,
"x": 1,
"y": 1,
"curve": [ 0.25, 0, 0.75, 1 ]
},
{
"time": 0.1,
"x": 1.15,
"y": 1.15,
"curve": [ 0.25, 0, 0.75, 1 ]
},
{ "time": 0.3333, "x": 1, "y": 1 }
]
}
}
},
"Select": {},
"Transform": {}
}
}
But we are not exporting them as JSON, I just exported it so content could be seen. That JSON is exported from the same file that when exported to .skel throws the error above.
Unfortunately we could not reproduce your exact error. Which version of the Spine Editor and Spine-Unity runtime are you using?
If they are up to date, could you please send us a zipped version of your exported files, as well as your project files (if possible). You can send it to contact@esotericsoftware.com.
I just tested it with a fresh Unity 2018.3.9f1 and Spine-Unity 3.7 runtime, got the same error. So I have concluded that the issue is with the way the spine file is made. Could you take a look at it? ItemA.spine
Unfortunately we are still receiving a different exception message than the one you have described.
In order to be sure to fix your exact problem efficiently, could you please send us the a zipped version of your exported files (the .json
, .atlas
and .png
files), and - if possible - your complete project files including the image files, not only the .spine
file. You can send it to contact@esotericsoftware.com. Thanks!
It looks as if there is a bug in importing the non-existing "default"
skin from binary .skel.bytes files. We will get back to you as soon as it is resolved.
The problem is resolved, a new unitypackage has just been uploaded.
You can download it here as usual:
Spine Unity Download
This happened when you have at least one attachment that not in any skin.
This answer maybe late for you but it can be helpful for other people like me. I didn't find any solution any where so I need to figured it by myself.
Thanks for sharing, and sorry to hear you've been having troubles as well.
I'm not sure I completely understood your situation: Are you still facing this issue using the latest spine-unity package?