Custom 2D armor slots

Hey, I’ve have an issue that I can’t seem to find an answer to.
I’ve been trying to make a fully customizable character, for a RPG i’m starting to work on. I want to make it so that hair style, chest armor, leg armor, eye color is fully custom, and that if you change it in your inventory, it will change your overworld appearance.

Issue is that I don’t exactly know how to go about doing that.

I do know that the way to go would be to separate the player into different animations per custom item, having each animation for each item loaded over a base sprite. For example, if you want to change your hair style or color, what would happen is that it will change a single animation over the base character that makes up the hair portion of the character. However, I do not know how to change the animation based on the value of the assigned hair style nor do I even know how to load the hair animation on top of the base player sprite or adjust its positioning via use of code.

Mostly, as of right now, I just want to learn how to create and place the animation over the character and animate it in sync with the base body, as well as switch out the animations based on particular values set based on what is equipped…



Let’s say, for example, I want to have a custom hair slot that you can change within the game. How would I animate the sprite as a separate entity without having to merge the two spritesheets, as merging them would mean that it would be required to create a character sprite for every hair, armor slot, and weapon slot possibility, which would be extremely time consuming.

I believe how this is normally done is that you would have an overarching player gameobject. Let’s call this Player. Under Player you would create other gameobjects that relate to other aspects. Let’s call one Hair and another Shoes.

So now in the inspector you have something like:

--> Hair
--> Shoes

Note: You could also make the body game object and that could be the body. I don’t normally work in 3D so it’s up to you.
But as I have it configured above. The Player will hold the body default shape. Then each other component like hair and shoes will also have their individual graphic that could be changed by code changes or gui changes. You will have to make the images the same size overall so the middle will be the same or know for each different type of part the adjustments needed so it would work.

Then in the Player you can animate everything there using code for each component. As the pieces/parts like Shoes and Hair are a subcomponent, they will follow the Player gameobject around.