I am using the new HDRP/LitTesselation shader.
I would like to change the Base Color + Opacity at runtime:

I added this code to the game object's script:
void start()
{
Color color = new Color(100, 50, 100, 150);
//Fetch the Renderer from the GameObject
Renderer rend = GetComponent<Renderer>();
//Set the main Color of the Material to green
rend.material.shader = Shader.Find("_Color");
rend.material.SetColor("_Color", color);
}
But it generates an Hidden/InternalShaderError error in the shader. Can anyone point me in the right direction?
I got it working by modifying these lines as follows:
rend.material.shader = Shader.Find("HDRenderPipeline/LitTessellation");
rend.material.SetColor("_BaseColor", color);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With