- Home /
Question by
ChocoCheezits · Oct 17, 2020 at 09:55 PM ·
c#colorspriterenderer
How can I set the color of a sprite with the Sprite-Lit-Default material?
I have an object that I upgraded to the URP Sprite-Lit-Default material, but since I did that, the code I wrote to set the alpha color doesn't work at all. Upon further testing, I realized that it doesn't seem to work with red, green, blue, or alpha.
Color c = rend.material.color;
c.a = 120;
rend.material.color = c;
In the code above, rend references my sprite renderer. What do I have to do to change the color values from code on the upgraded material? I would like to use some lighting effects, so I don't wanna just switch to something else.
Comment
Your answer
Follow this Question
Related Questions
Problem with a color randomization 2 Answers
Finding all sprite renderers in the scene and tell them to change color 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers