Sprites and Shaders : problem with lighting
I have attached a material(sprite/diffuse) and it works if i keep facing the right (transform.local scale positive 1) but when i start running left I will flip the local scale to negative 1 once i flip the sprite will turn black and if i turn back to facing right the shader stays black within light Here is the Flipping Script
 void Flip()
 {
     facingRight = !facingRight;
     Vector2 theScale = transform.localScale;
     if(facingRight)
     {
         theScale.x = 1;
     }
     if(!facingRight)
     {
         theScale.x = -1;
     }
     
     transform.localScale = theScale;
 }
 
               To Go more Indepth with the problem if i physically change the transform scale in the inspector to -1 the shader will still work but the second I hit the movement to go left the shader turns black, any advice?
Answer by KTurbo · Mar 12, 2016 at 12:09 PM
I've been struggling with this problem for a bit. Luckily I found the problem rather quickly. Make sure to scale the sprite with Vector3 and set the z-value to 1. My problem was that I was scaling with Vector2 and that sets the z-value to 0.
Exactly this was my problem too, fixing the Z value of the scale worked for me!
Thanks!
Answer by Ferofax · Feb 05, 2016 at 06:16 PM
I too am having this problem.. any chance you figured it out ?:)
Your answer