Search Unity

Changing the transparency of an object. Switching alpha on shader/texture?

Discussion in 'General Graphics' started by codejoy, May 7, 2018.

  1. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    So I have this object in my scene that has a stone like material. I want to make it semi transparent. I can in the Standard shader, pick the transparent rendering mode and set the alpha in Albedo color to like 111. It looks great but the problem is:

    how can I set this in code? And also all things in a scene that share the same material have the same effect applied to them. Anyway to change this?
     
  2. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    Ahh I figured out how to do it:

    this.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);