- Edited
Isaac

- Aug 30, 2021
- Joined Jun 29, 2019
Hello,
I'm looking into upgrading our Unity runtime from 3.8 to 4.0-2021-08-16, and I'm having trouble importing the re-exported characters that I exported with Spine Pro 4.0.23. Some of our spine characters import fine, but the more complex ones don't load in unity and give the error:
Error reading skeleton JSON file for SkeletonData asset: cha_littlePeople_SkeletonData
Error reading animation: torch_animations/anm_walk_torch
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at Spine.SkeletonJson.ReadSkeletonData (System.IO.TextReader reader) [0x01393] in C:\isaac\mm-bitbucket\ce2-console\Assets\Plugins\Spine\Runtime\spine-csharp\SkeletonJson.cs:368
at Spine.Unity.SkeletonDataAsset.ReadSkeletonData (System.String text, Spine.AttachmentLoader attachmentLoader, System.Single scale) [0x00017] in C:\isaac\mm-bitbucket\ce2-console\Assets\Plugins\Spine\Runtime\spine-unity\Asset Types\SkeletonDataAsset.cs:258
at Spine.Unity.SkeletonDataAsset.GetSkeletonData (System.Boolean quiet) [0x000c4] in C:\isaac\mm-bitbucket\ce2-console\Assets\Plugins\Spine\Runtime\spine-unity\Asset Types\SkeletonDataAsset.cs:173
UnityEngine.Debug:LogError (object,UnityEngine.Object)
Spine.Unity.SkeletonDataAsset:GetSkeletonData (bool) (at Assets/Plugins/Spine/Runtime/spine-unity/Asset Types/SkeletonDataAsset.cs:176)I've emailed one of the exported characters to contact@esotericsoftware.com - please can you look and let me know if this is a bug or an issue with our export settings? I've tried the usual tricks of deleting and re-exporting/importing of course, including with a brand new unity project and a fresh spine import. I'm using Unity 2020.3.14f1.
Thanks,
Isaac- Edited
Hello,
at this page: Coding for Spine Events and AnimationState callbacks: Events During Mixing
It states regarding EventThreshold:
"Setting this or the default value to the appropriate value for your animations is important"
But - how do I set the default value? It appears to be hardcoded to 0 in AnimationState.NewTrackEntry().
Thanks!
Hmm, we can't seem to work out how to create these folders within Spine. Can you help with that or point me to the documentation that explains it?
Ah - that's very helpful, thanks!
The skin selector, within unity:
- Edited
Hello,
We're building a game with a pretty extensive mix&match system, and as such have a large number of skins in one spine character. By the time we're content complete we'll probably have well over 300 skins.Picking the skins in the editor is currently a very laborious process, as it uses a very generic windows drop-down menu for the selection. Is there any chance this could be improved, to have a UI closer to the standard Unity asset picker, complete with search/filtering?
Thanks!
Hello,
I'm trying to get our custom mix&match setup working with AtlasUtilities.GetRepackedSkin. Everything appears to be created correctly, and the generated texture looks fine without any artifacts in it, but the rendered Mesh has a strange offset/zoom apparent, something that would be created by bad UV coordinates in the resulting Skin.I'm creating the skin as follows:
void CopyAttachments(Skin from, Skin to) { if (from == null || to == null) return; foreach (var attachment in from.Attachments) { to.AddAttachment(attachment.Key.slotIndex, attachment.Key.name, attachment.Value); } } public SkeletonAnimation AnimationComp; public void SetupSkins(List<string> skins) { var skeleton = AnimationComp.Skeleton; SkeletonData skeletonData = skeleton.Data; // Create a new skin, and append those skins to it. Skin targetSkin = new Skin("TargetSkin"); foreach (var option in skins) { if (option == null || option.Length == 0) continue; var srcSkin = skeletonData.FindSkin(option); if (srcSkin == null) { Log.warn($"Unable to find skin '{option}' in skeleton '{skeletonData.Name}' for char '{gameObject.name}'"); } else { CopyAttachments(srcSkin, targetSkin); } } Material runtimeMaterial; Texture2D runtimeAtlas; targetSkin = AtlasUtilities.GetRepackedSkin(targetSkin, $"{gameObject.name}_Skin", Shader.Find("Spine/Skeleton"), out runtimeMaterial, out runtimeAtlas, 4096, 0, TextureFormat.RGBA32, false, useOriginalNonrenderables:false); // Set and apply the Skin to the skeleton. skeleton.SetSkin(targetSkin); skeleton.SetSlotsToSetupPose(); AnimationComp.Update(0); AnimationComp.LateUpdate(); }
This is how the skin looks without the GetRepackedSkin call (doesn't look great because of Point filtering but ignore that):
And here's how it looks with GetRepackedSkin:
As you can see, the mesh looks the same in both cases, but the texture appears to be scaled up after GetRepackedSkin, leading to noticable cropping of the outline at the top of the hat, for example.
You can find an example project with this issue here:
Thanks for the support.
Isaac
update:
After some experimentation, I've discovered that the bug does not occur after exporting from Spine with 'Strip Whitespace X/Y' both switched off.- Edited