[SOLVED]Sprite with custom shader disappers when scene is played

I was creating a dissolve shader for a 2d game i am working on. It works fine for tileMap and other sprites.

  1. Sprite works fine in the editor window but in the play mode it disappears in both scene and game view.

Is this due to color of the sprite i.e black and white?

Here is the Dissolve Shader Graph.

When in scene view
masculineequalhapuku

when in play mode in game window. Also one can observe that the sprite animations are playing the MainTexture section in the inspector window.
veneratedbigagouti

  1. The layer order is not followed and the spriteRendere to which the material is applied is overlapped by other layers.

Setup:
Unity 2018.2.14f1
Shader Graph 3.0.0 preview

Update: change to scaling made it disappear.

  • I handle the direction facing by setting the scale values. to 1 or -1 so when i removed this it starts working fine.
  • Also i have come across some post related to scale and shader issue. will read on that for now.

It was just a stupid mistake, when setting the localScale for the sprite i was using.

transform.localScale = new Vector2(1, 1);

instead of

states.mTransform.localScale = new Vector3(1, 1, 1);

Due to which my Z component of scale was set to 0.

Mods can close this thread.