Loading the same skeleton twice causes flickering
I have a Skeleton in a Scene with an idle animation and a standard skin and everything works fines. When multiple copies of the same skeleton (with different skins) are present in the scene and I move the camera or animate the skeletons, the pieces of the skin start to flicker
I've noticed that the skeletons have multiple materials (11, across 4 different altases) and we believe this causes the issue but we have not made progress so far
Is it a known problem? What can we do?
What shader are you using at the materials? Did you enable Write to Depth
at the material properties?
In general it sounds as if you are encountering Z-fighting. This can be countered by setting the Advanced - Z Spacing
parameter at your SkeletonAnimation
component to a small value other than 0.
If you are having problems only between multiple separate skeletons, you can also attach a SortingGroup
component to each skeleton, then the ordering will be grouped by skeleton.
I don' think I have a Write to Depth option in the material with the Spine/Skeleton shader (see attachment)
I tried to increase Z spacing but nothing changed. I can also try to add a SortingGroup to each skeleton but I don't feel like that's the problem:
can the problem be related to the fact that materials in Unity are shared and if I have the same skeleton twice on screen with different skins the shared materials conflict with each other?
Thanks for your help : )
EDIT: I tried the Sorting Group solution and it works! I still need to do some tests but it looks promising
Thanks for getting back to us.
robertocasanovi :EDIT: I tried the Sorting Group solution and it works! I still need to do some tests but it looks promising
That's why I suggested it.