- Home /
How to access SpriteRenderer Color from a shader?
I've been looking all over the place and there must be a way to do this. I don't want to have to instantiate my material over and over just to change each one's color ever so slightly because that would kill my draw calls. How can I get my shader to reference the Color property of the SpriteRenderer?
hey, I'm having the same issue you did but am new to shaders. I'm better at exa$$anonymous$$ing code examples than just words. at the moment I have no idea how to reference other objects through the shader. and could use the help
Answer by eightbitstev · May 14, 2014 at 02:41 PM
Nevermind, I figured it out! It was just a matter of grabbing vertexColor from the VertexInput struct and then using it in my vert shader function.
Great! Just had the same problem when using AmplifyShaderEditor and the vertex color contains the color from the spriterender component :)
Made me feel like an idiot too, thanks for the answer!