In Unity Editor: Edit > Project Settings…
Add Legacy Shaders/Transparent/Diffuse
Add Legacy Shaders/Transparent/Diffuse
In the code file:
var shader = Shader.Find("Legacy Shaders/Transparent/Diffuse");
foreach (Transform child in MyGameObject.transform)
{
var renderer = child.GetComponent<Renderer>();
foreach (var material in renderer.materials)
{
material.shader = shader;
material.SetColor("_Color", new Color(material.color.r, material.color.g, material.color.b, 0.4f));
}
}
Comments
Post a Comment