Flickering issue with sprite-diffuse

Hello,

I’m using a single directional light and would like all of my sprites to be effected using the sprite-diffuse shader. This seems to work but will cause flickering on prefabs of the same object that use the diffuse-shader.

I’m not sure what’s ultimately causing the issue, but I’ve noticed if I either duplicate the shader, so each prefab uses a separate shader, or duplicate the sprite, so the shader references a separate sprite on each prefab, the flicker doesn’t exist.

It seems most noticeable by moving the camera on the x axis across the sprites. I’ve attached an image for reference.

Any insight would be much appreciated.

29788-flicker.png

It might be because they have the same order. Try changing “Order In Layer” for the objects and see if the error persists. If this fixes it, then you could write a script that increments “order in layer” for each new object.

I ran into this same issue. It appears to be a bug in Unity where for some reason, it doesn’t calculate the right lightDir for surface shaders 100% of the time. Luckily, this bug seems limited to the “Transparent” queue. If you use your own version of the Sprites/default shader (original source from [http://unity3d.com/unity/download/archive][1]), but with the Queue=“Transparent” line removed, the flickering should disappear.