color changing through a script

I need help changing the color of a material through c# code, I do not want to use just generic colors in the script like red or green, but I need to convert the hex of teh objects I want to usable rgba code. I created four dummy materials for the colors I want to use, how can I set a string or an int to those colors so that I can change the color of the main material?

You want the ColorUtility class

okay thank you, but i have two materials assigned as material 1 and material 2, if I wrote
Material1.color=material2.color, would that work? I have not been able to test it out yet, so that was my temporary solution.

That would set material1 to have the same color as material2. If that’s what you want then sure :slight_smile: