Quantcast
Channel: How to change alpha of a Shader in Unity by code - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to change alpha of a Shader in Unity by code

$
0
0

I have a GameObject with a material set to transparent, and I want to change its alpha to 80 instead of 255.But I want to do it by code, not with the editor sliders.Is there a simple way to change the alpha of a shader using just a line of code?Something like:

MyObject.GetComponent<Material>().shader.alpha = 80;

I've looked around the internet and I've found only more complex solutions...


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images