Quantcast
Channel: Latest Questions by weltraumaffe
Viewing all articles
Browse latest Browse all 12

Set alpha in Standard Shader

$
0
0
I want to set the alpha of a material with the Standard Shader. I created the following method. public void SetAlpha(float alpha) { Material mat = new Material(_meshRenderer.sharedMaterial); mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, alpha); _meshRenderer.sharedMaterial = mat; } However after using the method the new alpha value is not displayed. When I inspect the Material the new alpha value is shown. Only if I modify the alpha value by hand does the value get updated. **EDIT** I already made sure that the render mode is set to transparent in the base material.

Viewing all articles
Browse latest Browse all 12

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>