Sprite Rendering Behind Transparent Shader

I have a shader that is used to see through walls when the player is behind them. (Pic 2)

However due to the way transparent shaders work it’s sometimes rendering my player behind 3D objects, despite him not actually behind behind them.

I know it’s the shader because the player renders correctly when it’s not applied.

What can I change in my shader to make this work as intended, I am using Shader Graph to create my shaders.


  • Shader Graph in comments

Did you ever figure this out?