Change Color of material only white?

Hi,
my problem is that when I change the Color of a Material in C# Script it always change to white.
Here is the part of my script (I have to safe the color in the system so I made it like this)

PlayerMaterialColor = new Color
                (PlayerPrefs.GetFloat("Red" + (PlayerPrefs.GetInt("SelectedPlayerColor") / 255)),
                PlayerPrefs.GetFloat("Green" + (PlayerPrefs.GetInt("SelectedPlayerColor") / 255)),
                PlayerPrefs.GetFloat("Blue" + (PlayerPrefs.GetInt("SelectedPlayerColor") / 255)));
    
            PlayerMaterial.SetColor("_Color", PlayerMaterialColor);

Any Ideas?

In case anyone else has this issue, here is what I had to do to fix it. I don’t know if this will work for you, but since OP did not provide the solution to his problem I figure it may at least put you on the right path.

I was trying to use Int as a variable for the RGB values, however these need to be converted into floats (for Color) or bytes (for Color32). If you use Color, the float needs to be between 0 and 1, so you can calculate the value by dividing it by 255. For Color32, byte is more straight forward.

no wait :confused:
found the mistake :smiley: