How do you access or change a material's color information in script when using the Lightweight Rendering Pipeline?

It seems that the API related to Material.color doesn’t work with the LWRP. For example, the sample code here (Unity - Scripting API: Material.color) appears to do nothing when applied to a cube in the LWRP template project’s sample scene.

Hi, I am having difficulty when swapping to LWRP also, my fix just now is this.

Create any new material with the corresponding colors you wish to use and access then from the code, i.e.

public Material yellowmat;
public Material bluemat;

Then during Update()

access the materials using GetComponent().material = yellowmat or bluemat;
for instance I use if a target is visible then swap the materials

if(targetIsVisable){
GetComponent().material = yellowmat;
} else GetComponent.material = bluemat;

I hope this helps as a quick fix until it can be done quicker?

I would also like a lot more information on this topic and a whole book on learning the pipelines etc as I am quite new to all this.