How to make game object transparent in unity

Code Example - How to make game object transparent in unity

                
                        GameObject g;

// 50% Transparency.
g.renderer.material.color.a = 0.5f; // a is the alpha value.

 // 100% Transparency.
g.renderer.material.color.a = 1.0f;