Before I begin, Our project is running a very old version of the Spine Unity Runtime: Version 2.3.

We're experiencing some memory crashes on the Nintendo Switch, and profiling is revealing a steady increase in our Mesh memory. I'm not the most familiar with SkeletonRenderer.cs but is there dynamic mesh stuff happening there? Is there a way to manually delete mesh data or free it when its no longer being used?

Generally, I'm looking for a little enlightenment on the Spine Unity stuff, and mesh memory in general. It might help fix our Switch blocker for lotcheck.

Thanks in advance

Ko Costarella
Software Engineer, HumaNature Studios Inc
Posts: 1


Yes, Spine skeletons are rendered as dynamic meshes by SkeletonRenderer.

Just to point how they are currently being destroyed:

You'll find the OnDestroy of SkeletonRenderer calls rendererBuffers.Dispose();
spine-runtimes/SkeletonRenderer.cs at 3.6

Which disposes the smart mesh class:
spine-runtimes/SpineMesh.cs at 3.6

Which ultimately calls UnityEngine.Object.Destroy(mesh) on the meshes.
spine-runtimes/SpineMesh.cs at 3.6

I'm not sure if Unity's Switch support may have some different behavior regarding this.
If you can iterate quickly, it may be worth checking the hideflags of the dynamic mesh generated:
spine-runtimes/SpineMesh.cs at 3.6

Also, currently, SkeletonRenderer's MeshRendererBuffers rendererBuffers is a private member so you'll have to modify SkeletonRenderer to do some things to it, either within it or from another class.

We've also had some user report mesh leaks a few months ago which we fixed. I hope you have a more recent version of Spine-Unity where those have been fixed.
User avatar

Posts: 5009

Return to Unity