Projector - blob shadow. How to change the material's alpha channel C#

Hi,
Im using a projector for a blob shadow and I need to set up a script that allows me to lerp the shadow brightness from light to dark. How can I do this?
I know the material the blob shadow uses must have an alpha channel, so is that what I need to control to get from dark to light?

Sounds like you might be able to do something like that by modifying your projector material’s color - depending on what shader it is using.

Assuming modifying the color will work, including modifying the alpha channel of the color, you could do something like the following. Also, you have to know the name of the color property in the shader. Most of the time the main color is named “_Color” and you can access it with myMaterial.color. But in case it is named something else, you can do:

// Get the current color value
Color color = myMaterial.GetColor("_Color"); // or "_TintColor", whatever the shader uses.
// Modify the color however you want, the whole color, just a channel like so, whatever.
color.a = .1f;
// Set the color back
myMaterial.SetColor("_Color", color);

You could modify the materials colour directly, without going through the shader:

Color newColour = GetComponent<Projector>().material.color;
		newColour.a = 0.1f;
		GetComponent<Projector>().material.color = newColour;

This will change your materials colour even outside play mode. Not a big deal, because you could change it back from the inspector if you want.