Ludeon Forums

Ludeon Forums

  • August 11, 2022, 02:35:33 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [Solved] Trying to change hair color midgame  (Read 556 times)

simonster99

  • Muffalo
  • *
  • Posts: 4
  • Refugee
    • View Profile
[Solved] Trying to change hair color midgame
« 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?
« Last Edit: October 14, 2021, 12:25:36 PM by simonster99 »
Logged

simonster99

  • Muffalo
  • *
  • Posts: 4
  • Refugee
    • View Profile
Re: [Solved] Trying to change hair color midgame
« Reply #1 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
Logged

JT

  • Colonist
  • ***
  • Posts: 136
  • Big Whoop
    • View Profile
Re: [Solved] Trying to change hair color midgame
« Reply #2 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.
Logged