I have tried this Code section(Rear lights activation) for SRP in my Car Race game and it worked completely fine. I am trying to activate Rear Light’s Material by changing its emissive properties when player pushes “s” key or “space” key.
But when I upgrade my project to HDRP, this code fails.
Anyone knows how I can alter my code to make it work. Thanks in Advance.
private void turnLightsOn(){
if (lightsFlag) return;
brakeLights.SetColor("_EmmissiveColor", Color.red *5);
lightsFlag = true;
}
private void turnLightsOff(){
if (!lightsFlag) return;
brakeLights.SetColor("_EmissiveColor", Color.black);
lightsFlag = false;
}