Ludeon Forums

RimWorld => Mods => Help => Topic started by: simonster99 on September 30, 2021, 02:10:19 PM

Title: [Solved] Trying to change hair color midgame
Post by: simonster99 on September 30, 2021, 02:10:19 PM
Hello!

I'm currently trying to change the hair color of a pawn midgame. The piece of code I have currently that is supposed to change the hair color is this.

P1.story.hairColor = Color.green;

The problem is that when I trigger the code nothing happens, but when I quit to menu and reload the game, the hair changes to the intended color.

Any tips on how I could make the hair change color as soon as the code is triggered?
Title: Re: [Solved] Trying to change hair color midgame
Post by: simonster99 on October 14, 2021, 12:28:08 PM

Incase anyone is looking for the answer in the future, here's how I managed to solve this:

Pawn.Drawer.renderer.graphics.ResolveAllGraphics();

I guess this reloads the graphics of the pawn somehow, making any changes to the hair color appear right away. Probably not the best solution, but it works for me
Title: Re: [Solved] Trying to change hair color midgame
Post by: JT on October 24, 2021, 10:35:03 AM
Nope, that actually is the best/only solution.  RimWorld 1.3+ caches the pawn graphics, unless you're using a mod like Graphics Settings, HD Pawn Renderer, etc.