In short: I am emitting particles with the Particle System, its shape module has the Spines mesh referenced. Whenever I stop the particle system I get errors. The spine has a SkeletonRenderSeparator.

More detailed: My Spine character has a SkeletonRenderSeparator. During gameplay the character can catch fire. The fire is a pooled object with a Particle System, that has its Shape module set to “Mesh Renderer” and Type to “Triangle”. When the fire gets attached to the character, the Particle System sets its referenced Mesh to one of the characters Parts Renderers (see the SkeletonRenderSeparator).
When the fire is done, it returns to the pool. It sets all previous references to the character to null (e.g. “Mesh” in the particle system gets nulled). Also I Stop and Clear the Particle System. Even though I’ve done all that, I get this error whenever the character animates (this error starts after the fire got disabled):

Particle System can only spawn from mesh if all submeshes use the same primitive type
UnityEngine.Mesh:SetTriangles (int[],int,int,int,bool,int)
Spine.Unity.MeshGenerator:FillTriangles (UnityEngine.Mesh) (at Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs:1282)
Spine.Unity.SkeletonPartsRenderer:RenderParts (Spine.ExposedList`1<Spine.Unity.SubmeshInstruction>,int,int) (at Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderSeparator/SkeletonPartsRenderer.cs:126)
Spine.Unity.SkeletonRenderSeparator:HandleRender (Spine.Unity.SkeletonRendererInstruction) (at Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderSeparator/SkeletonRenderSeparator.cs:273)
Spine.Unity.SkeletonRenderer:LateUpdateMesh () (at Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs:645)
Spine.Unity.SkeletonRenderer:LateUpdate () (at Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs:589)
Spine.Unity.SkeletonMecanim:LateUpdate () (at Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs:180)

Is this a Spine bug, a Unity bug, or a me bug?
Just something I found online that may help: Stopping a particle system often involves a cleanup process that can interact with mesh data (?), potentially triggering the error if the mesh data is not in a valid state (?).

Related Discussions
...

The issue you're encountering with the Particle System and SkeletonRenderSeparator seems to be related to how the mesh data is being handled when the Particle System is stopped and cleared. This is not necessarily a bug in Spine or Unity, but rather a result of how the mesh data is being managed during the cleanup process.

Here are a few steps you can take to potentially resolve this issue:

  1. Ensure Proper Cleanup: When you stop and clear the Particle System, make sure that all references to the mesh are properly nullified and that the Particle System is fully reset before it is returned to the pool. This includes ensuring that the Mesh reference in the Shape module is set to null.

  2. Check Mesh Data State: Before stopping the Particle System, ensure that the mesh data is in a valid state. This might involve checking if the mesh is still being used by the Particle System and if it has been modified in any way that could cause issues.

  3. Disable and Re-enable Render Separator: As a workaround, you can try disabling and re-enabling the SkeletonRenderSeparator component when the Particle System is stopped. This can help reset the state and avoid any potential issues with mesh data. This approach has been suggested in similar contexts:

       skeletonRenderSeparator.enabled = false;
       skeletonRenderSeparator.enabled = true;
  4. Modify Mesh Handling Code: You can modify the code in MeshGenerator.cs and SkeletonPartsRenderer.cs to add additional checks or handle the mesh data more gracefully. For example, you can add a check to ensure that the mesh data is valid before attempting to set triangles:

       if (mesh != null && mesh.subMeshCount > 0) {
           mesh.SetTriangles(triangles, submeshIndex, calculateBounds, baseVertex);
       }
  5. Separate Initialization Script: Initialize the SkeletonGraphic object via a separate script independently before any Timeline activation event, as suggested in the context:

       skeletonGraphic.Initialize(false);

By following these steps, you should be able to mitigate the errors you're encountering with the Particle System and SkeletonRenderSeparator.

    Spinebot
    Managed to fix it with the help of Spinebot, basically it was point 1. "Ensure Proper Cleanup".

    public void StopAndClearAllSystems()
        {
            foreach (var system in ParticleSystems)
            {
                var shape = system.shape;
                shape.meshRenderer = null;
                shape.spriteRenderer = null;
                system.Stop();
                system.Clear();
            }
        }