How do i make it semi-transparent?

I want to make any objects that pass into a certain area semi-transparent. I tried doing it by changing it by doing theThingIWantTransparent.getComponent<Renderer>().material.color.a = 0.5;, but i get error CS1612, and it says:

Cannot modify a value type return type of UnityEngine.Material.color. Consider storing the value in a temporary variable

What is the best way to do this? And if this is the best way, how do i make it work?

Like the message says, store it in a temporary variable…

Color newColor = theThingIWantTransparent.getComponent<Renderer>().material.color;
newColor.a = 0.5f;
theThingIWantTransparent.getComponent<Renderer>().material.color = newColor;