- تم التحرير
Unity, broken spine objects on android devices.
Hi,
recently I've noticed some broken spine objects in our builds on all android devices.
For example, I have animated chest. In unity editor looks absolutely fine but on devices looks like it Z-fights with invisible plane. There are visibile glitch lines. Whole animation is in UI and doesn't even have depth testing on (or at least it shouldn't have).
Result looks like this:
Can somebody please tell me where might be the problem? Has anybody seen that kind of bug before?
I've tried complete project cleanup, reimport. College also exported spine again and nothing helped. It worked for one month, nobody touched that since it was included into out project and just now it broke. We didn't upgrade unity, spine runtime nor spine editor.
Just few parameters:
Unity 2019.3.0f5 Window 10
Spine 3.8-2020-03-02 (and spine editor 3.8)
Thank you.
Miro
@PIXELFEDERATION
Update:
I've managed to make workaround by adding
ZTest Off
to Spine-Skeleton.shader
It's not a good fix, but since it works there is a new question:
Why 2D spine object in GUI even tests depth and why depth test is not optional?
We are sorry to hear the you are having troubles, thanks for investigating the problem.
All SkeletonGraphic
shaders included in the spine-unity runtime are using the ZTest
mode dictated by the Unity UI system:
ZTest [unity_GUIZTestMode]
It is strange that this would not be set to Always
by the UI system anyway. Are you using a different shader perhaps?
I missed a part in your posting:
to Spine-Skeleton.shader
You are indeed not using the SkeletonGraphic
shaders, which explains the incorrect ZWrite
mode. Please use only the provided SkeletonGraphic
shaders on UI elements with SkeletonGraphic
components.
Thank you! That worked.
I've used the default material created by spine importer and it set wrong shader.
Please do not assign the generated materials of the skeleton directory to SkeletonGraphic
, they are created for SkeletonAnimation
and SkeletonMecanim
. When you instantiate a skeleton as SkeletonGraphic
, it assigns SkeletonGraphicDefault
on purpose, which can be shared across all SkeletonGraphic
GameObjects.
The SkeletonGraphicDefault
material can be shared even when used with different atlas textures because it does not store the texture reference at the material, instead it is set from the CanvasRenderer
component (as always is the case with UI renderers).
If you need to customize some material parameters for some skeletons, it is recommended to copy the SkeletonGraphicDefault
material and change values at this copy. You can then assign this shared material to multiple skeletons again that share the same set of parameters.