how set color transparent C# ?

hi

I’m trying to set color transparent

this is me code change color

   public Color colorred;
  hideMaterial1.color = Color.white;    

but when change color it set transparent A 255 this make it not transparent

There is a way to change the color while keeping the transparency
thank you

Note i have try this color.a = 0.42f; Not Working

You need to cache the color value, change it, then set it.

public Color tempColor;
tempColor = hideMaterial1.color;
tempColor.a = 0.42f;
hideMaterial.color = tempColor;

Make sure the selected shader in your material supports transparency, otherwise you won’t see it!