get shader unity c# code example
Example: get shader unity c#
using UnityEngine;
public class Example : MonoBehaviour
{
// Create a material from code
void Start()
{
// Create a material with transparent diffuse shader
Material material = new Material(Shader.Find("Transparent/Diffuse"));
material.color = Color.green;
// assign the material to the renderer
GetComponent<Renderer>().material = material;
}
}