I’m trying to assign an HDR emission color (with components with values greater than 1.0) to a material at runtime via script, but I’m not sure how to do this. I’m using a Color, but all my values get clamped to the usual 0-1 range. I can set a >1 value using the material inspector, but I don’t seem to be able to accomplish the same effect via script at runtime. To be clear, I’m able to assign a color to the material, just not an HDR one with components outside the usual 0-1 range.
private Color laserRed = new Vector4 (1.988f, 0.438f, 0.438f, 1.0f);
void Start() {
laserMaterial.SetColor("_TintColor", laserRed);
…
You can create as many Vector4 colors as you want and simply assign them using yourMaterial.SetColor(“_TintColor”, yourColor); anywhere in your script.