Answers for "get shader unity c#"

C#
0

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;
    }
}
Posted by: Guest on December-14-2020

C# Answers by Framework

Browse Popular Code Answers by Language