Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity transparent object

//For 2D sprites :
public GameObject myObject;

public void makeTransparent()
{
  var col = myObjetc.GetComponent<SpriteRenderer>().color;
  col.a = 0.5f; //Change the value of transparency here (with 0 = totally transparent and 1 = not transparent at all)
  myObjetc.GetComponent<SpriteRenderer>().color = col;
}

//For 3D gameObjects :
I think you have to use shaders there are a lot of youtube videos it is not only with a script
 
PREVIOUS NEXT
Tagged: #unity #transparent #object
ADD COMMENT
Topic
Name
7+9 =