How can I replace a material properly during runtime using C#.

When the material on the object changes during runtime, the HDR Emittance color/intensity is Black and at zero. When I manually change it in the editor, the emit values are fine.

public Material YellowStar;

“some function”
gameObject.GetComponent().material = YellowStar;

I figured it out, I had animations with emission animations. I had them set so that each time they played they would go back to frame 1 and pause until they were triggered to play again.