Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

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;
Comment

PREVIOUS NEXT
Code Example
Csharp :: asp.net core miniprofiler 
Csharp :: The foreach Loop c# 
Csharp :: Long, Max and Min value 
Csharp :: hwo to prevent rotation after hitting an object in unity 
Csharp :: c# enum 
Csharp :: Dyanmically create datatable in c# 
Csharp :: c# get property type of list 
Csharp :: c# get list item in random order 
Csharp :: c# generate guid from hash 
Csharp :: check if an object is active unity 
Csharp :: columndefinition wpf 
Csharp :: asp.net response.redirect new tab 
Csharp :: c# add time to datetime 
Csharp :: C# clear form 
Csharp :: append 2 arrays c# 
Csharp :: c# operator overloading 
Csharp :: how to make pc bsod C# 
Csharp :: string tochararray c# 
Csharp :: if c# 
Csharp :: c# online compiler 
Csharp :: autofac .net core 6 
Csharp :: Search for a value into a list in c# 
Csharp :: encrypt with public key and decrypt with private key c# 
Csharp :: C# api get value from header 
Csharp :: c# modulo 
Csharp :: string to array c# 
Csharp :: string.QueryString c# 
Csharp :: expando object c# 
Csharp :: unity rb.addexplosionforce 2d 
Csharp :: math with c sharp 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =