Sprite Diffuse Material makes sprite black

Hello!
So when I’m trying to apply a diffuse shader sprite material to my sprites, it makes it go completely black. The lighting has no effect upon it. What’s up?

I’m using a directional light in my scene, because none of the other lights seem to work. What’s strange is that this same shader works on other sprites well, but not on certain objects.

With lit sprite shader
77531-with-shader.png

With sprite diffuse
77532-without.png

Your posting is old, I think it’s already solved the problem, but I’m putting it here to help anyone looking for the answer as I was. (I.e.

Windows> Lighting> Settings
It will open a window, on the Scene tab, look for Ambient Color and set it to white. :slight_smile:
I used Google translator, sorry for English. ’ :slight_smile:
Brazil here’. :slight_smile:

I was having a similar problem, what i didnt realize was that i had random z indexes on my game objects. This caused my light source to sit behind my objects and not cast light on them properly.


Setting my project to 3d (temporarily), and zooming around my scene in the editor really helped me understand what was going on. Even if your project is 2d, like mine, you can still do this.


Anyway, once i saw what was happening, i just had to adjust the z value of my camera to a negative value, less than what my objects were (so i tried -10 and kept going backwards until it started showing).


I also went through all my gameobjects that i wanted to light to hit, and manually set the z indexes to all of them to zero, and ensured that whenever i adjusted their localscale using code, i used Vector3 and set the z index (third parameter) to 0 as well.


You can try this - switch to the rotate tool in the editor and swing them randomly around until you see it hit and light up your object. This was useful for me to better learn how it was working.


Another thing to consider is the shader/material. If your gameobjects are using a material, make sure that material has a shader that supports lighting. I switched my material to use the UI/Lit/Bumped shader, which worked well for me.