Create Transparent Material at Runtime in Unity - Change Standard Mode with C# Script API
Channel:
Subscribers:
11,700
Published on ● Video Link: https://www.youtube.com/watch?v=ywIJ5YkW98s
Unity create Material on the fly - https://gist.github.com/iwanPlays/04d399de55a98475d906103779ba9ff3
Incomplete:
Material mat = new Material(Shader.Find("Standard"));
mat.SetColor("_Color", new Color(1,0,0,.5f));
mat.SetFloat("_Mode", 3);
mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
mat.EnableKeyword("_ALPHABLEND_ON");
mat.renderQueue = 3000;
//mat.SetInt("_ZWrite", 0);
//mat.DisableKeyword("_ALPHATEST_ON");
//mat.DisableKeyword("_ALPHAPREMULTIPLY_ON");
transparent material at runtime in player, via c# script api https://answers.unity.com/questions/999594/change-material-rendering-mode-but-dont-update-mat.html
Other Videos By iwanMods
Tags:
unity
coding
realtime
c#
api
material
transparent material