we've been using spine for our project for some time now, but yesterday we added a new animated character to a scene that suddenly started lagging.

I put the skeletonanimation in a new scene to do some profiling, in order to make sure nothing else was interfering. As it turns out, the Skeleton.LateUpdate takes up 18ms

Screenshot 2021-10-16 at 10.26.33.png

The model itself does have over 3k verts, which is not exactly light, but it's not much more than our hero character which only costs 1.8ms in LateUpdate. Surely there's something else that's making it cost 10 times more.

Screenshot 2021-10-16 at 10.27.34.png

The model itself doesn't have that many constraints either.

Edit: I just noticed that the CPU cost is not dependent on the animation that is played. Even if the animation is set to "None" the CPU cost is identical. I just did a profiling for all other spine assets in my project and there's only 2 of them that have this issue, both of which have some animations which use a mask.

Screenshot 2021-10-16 at 10.28.19.png

Here is what it looks like in Unity in wireframe

Screen Recording 2021-10-16 at 10.47.50 (1).gif

I tried to enable all the optimisations in "advanced" rendering options. That allows me to gain 2ms but that's still 16ms, way too much.

My only hunch is that it may have to do with the fact that we're using a mask, but I can't see it being a good justification for such a high CPU cost.

What steps can I take to more precisely profile where the CPU cost comes from?


Well, as it turns out, the problem is indeed the masks. I can solve some of this by using a sprite mask in unity and a renderer separator. For the rest, I'll see with my animator how she can better optimize the masked meshes so as to reduce the performance impact.
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
  • Postovi: 16


Showing the metrics view in Spine for the skeleton would help, but I see you've figured out it's clipping. Clipping is expensive, some tips here:
Clipping attachments - Spine User Guide: Performance

  • Postovi: 11782

Natrag na Unity