• RuntimesUnityBugs
  • SkeletonAnimation sometimes blink when calling setSkin

Problem statement

I have build a character creator using spine. The spine model is painted by my artists, I'm using unity to create the character creator.

The spine model is comprised of several nested skins like below:

Now i have an issue in my creator where when i change between glasses and eyes i sometimes get a Unity error: "Invalid worldAAB object is either too large og too far away from the origin" as the error occurs the model starts to blink rapidly.

If i change to another pair of glasses/eyes the flickering stops. Changing hair style and other skins works fine, it's only the eyes/glasses where it happens.

We create the composite skin as adviced in the documentaiton:

        var skeletonData = _skeleton.Data;
        var characterSkin = new Skin("avatar");
        characterSkin.AddSkin(skeletonData.FindSkin(_avatar.Base));
        characterSkin.AddSkin(skeletonData.FindSkin(_avatar.Ears));
        characterSkin.AddSkin(skeletonData.FindSkin(_avatar.Hair));
        characterSkin.AddSkin(skeletonData.FindSkin(_avatar.Eyes));
        characterSkin.AddSkin(skeletonData.FindSkin(_avatar.Nose));

        // Set the active skin.
        _skeleton.SetSkin(characterSkin);
        // Use setup pose to set base attachments.
        _skeleton.SetSlotsToSetupPose();
        // Use AnimationState to set attachments active in the current movement.
        _animationState.Apply(_skeleton);

Here's a recording of the bug:
https://esotericsoftware.com/forum/assets/files/2023-11-14/1699967235-830771-2023-11-14-13-58-23.mkv

Sometimes when switching between eyes and glasses i see the models warp out of view, not sure if it is related?
Here's a video of that:
https://esotericsoftware.com/forum/assets/files/2023-11-14/1699967206-81964-2023-11-14-13-54-12.mkv

Is this a known issue?

Runtime information

We're running unity 2022.3.7 and the most recent spine packages:

The project also uses URP

Related Discussions
...

I've tried calling _skeletonAnimation.ClearState() before setting the skin, and calling LateUpdate once after setting it - to no avail :\

I think the issue has to do with switching between skins where in one skin it uses a skin slot, which is not used in the next?

Like my initial issue happened when switching between models which used an "eyes" slot to one that uses a "Glasses" slot. Now i've integrated the "diversity" slots and it happens more frequently..

Well actually i also saw it happen when switching between base and wheelchair... ugh

@Fjellvang Sorry to hear you're having troubles. Unfortunately we can't tell from a video alone. Could you please send us a minimal Unity project (with just the problematic skin combination, not everything available) which still shows this issue? You can send it to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at what's going wrong.

My Designer showed me that she has some warning in her file which she can't explain and she's not aware of how to inspect the warnings.

I'll soon be leaving the office for today, but i'll try and think of how i can share a version with just the bug. It's become quite a big project at this point and i cannot share it all for obvious reasons.

So my designer fixed the warnings, which in turn fixed the issue for now it seems!

I'm trying to get my designer to describe the fix, so i can post it here in case someone else has the issue in the future 🙂