The sprite color changes the hue of the sprite renderer, but I’m trying to create a shader that would take a color of 255 alpha and overlay in onto the sprite exactly. I’ve looked for tutorials but they all seem to use a texture2D to alter the color, however I would want this to work on a sprite with animations, meaning this would not work because the texture is altered over time. Is this easily possible with shader graph or another technique?
If the Texture2D property you’re sampling in the shader is named MainTex (which will be automatically converted to _MainTex) it will automatically update with the new texture if you change it I believe.
Otherwise you could always do: material.SetTexture([property name], [new texture])
Option A: SpriteRenderer.color defines the color for the whole sprite silhouette
Are you on 2023.3+ (Unity 6)? There’s a new feature to help you control the vertex color (SpriteRenderer.color).
If you’re on that version, you can get away with just toggling on “Disable Color Tint” then use the Alpha from your MainTex but use the Vertex Color node directly for the Color Fragment output. Then it’ll color the whole sprite in a silhouette with the SpriteRenderer.color.
Otherwise you have to do a hack to predivide the color away because it’ll apply automatically in a part of the shader you can’t control from Shader Graph, more here.
Option B: just use a Color property
Have a Color property on your Blackboard. Hook up that color property to the Fragment output’s rgb color. From the MainTex’s SampleTexture2D node, get its alpha and hook that into the alpha of the Fragment output. This keeps the sprite silhouette but uses the material’s Color to define the silhouettes color.