How do I make character color palettes for a 2D game?

I am trying to make a 2D fighting game with Unity 3D. I trying to understand how I can make different color palettes for each character. Here is what I plan to do, I will first make the animations and then color each animation for that character using the animation program I am using. Make an atlas and import into Unity. Then, to make the same character with different colors just recolor the the atlas and import into Unity. My confusion is whether or not this is the best way to do this? I am think that I can just make a gray scale character and apply the colors some how through unity. Then, I would need to know how to color the different parts of the character, i.e. hair, outfit, weapon, etc…? Any help would be appreciated.

I don’t think it’d be too hard to write a simple color palette-based sprite shader. That said, I don’t think there’s an easier way, except that there are also some assets you can buy that embed palette functionality.

For things that should be one color plus shading, grayscale and tinting the SpriteRenderer works fine.

However if you have a sprite where only a portion of it should be tinted, that’s where the problems arise.

One way I did this in the past was to have each Sprite asset that needed partial tinting to have a companion Sprite of the same dimensions, like a “color map” of sorts, with some special color for all the pixels that require tinting a color, with the rest of the image black.

So if the skin portion of a body sprite needed tinting, the image would be all black, but just the skin portions colored magenta. If some part of the body also needed tinting, it would get another special color for those pixels. Then at the start of the game I would take the chosen skin color (user selection maybe?), and using that map, tint each pixel corresponding to a magenta pixel by the skin color, creating a new sprite or updating the existing sprite with the result.

This is not something you should do during gameplay, this is a one-time setup kind of implementation.

You can use GetPixels32 and SetPixels32 and Apply() function to make changes to a new or existing Texture2D.