Change 2D sprites at runtime

Hello!

I have built a small character generator for 2D. The player should have the possibility to change his character at runtime. For example that he can change his character’s pants.

The character consists of a parent object and 7 children (head, hair, body, armor, pants…). Each child has a sprite renderer. Together they form the character.

Now I have added the animator and created all the animations. The animations/animator work. I can walk around with the character and all the sprite renderers work. To create the animations I used the default sprites of how the character should look at the start.

Now for the problem. I want to change individual sprites at runtime. But this does not work. It seems that the graphics in the animations keep overwriting my sprites in the sprite renderer.

The question is, what can I do here? According to my information, I need the graphics in the animations so that the keys can be set. I would like to overwrite these graphics.

Does anyone have an idea how to do this or a better idea to update the sprites?

Thanks a lot!

You can add transitions to your animation to fix it,
If you don’t know how to do a transition between animations in Unity, you can watch a tutorial, watching a tutorial doesn’t mean you are a bad developer. You are still learning!
If you can’t find a tutorial, you can ask ChatGPT to help you, he actually helps sometimes.

BUT WHAT AM I GOING TO DO IF I STILL CAN’T FIND IT?
I understand you because i encountered a similar error in my animation.
You can go to Unity’s official Discord server to ask for people to help instead of Unity Discussions. But still, if you couldn’t solve the problem don’t close this post, and wait for somebody actually helping. Or you can just go to the Discord server and ask for help if you can’t solve the problem.

Hope i helped, have a nice day.