I have never dealt with shaders in my life, and am quite new to Unity (but not to programming 2D games in C++ or C#).
Normally, I’d just edit the texture to “dye” a character image, but all characters in the game use the same sprite texture. A shader just sounds simpler, easier, and better. (This, decided in another thread, thank you.) This is mainly so every individual character can ahve their own colors for certain pixels.
I have tried to google for a bit, but figure it would just be easier, given how simple the request is.
The shader I need, simply takes an image, looks at all the pixels in it, and if the pixel is pure green (Color 0,255,0) then it dyes it to a different color.
Is there a simple line of code that I can write for a shader to simply do something like…
if( getPixel(x,y) == Color.green )
setPixel(x,y, Color.Brown)
I tried browsing the forums, but shader code looks like a completely different language to me.
edit: I guess I should add that the shader’s ‘change to’ colors is different for each character.
I didn’t think about it, but I am unaware if Shaders work the same way instantiating a character would, with something like…
if( getPixel(x,y) == Color.green )
setPixel(x,y, Character.hairColor)
That way each character can have different colors of hair.
Ugh, perhaps I should just do it the way I’d do it in C++/C#, and just edit the texture after copying it to a new texture in memory.