Unity 材质球shader替换简单使用

using UnityEngine;
using System.Collections;
public class TestScriptReplaceShader : MonoBehaviour
{
    Renderer re;
    // Use this for initialization
    void Start ()
    {
        re = transform.GetComponent ();
        Debug.Log ("材质球shader替换成(FX/Flare)");
        re.material.shader = Shader.Find ("FX/Flare");
    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKeyDown(KeyCode.A)) {
            Debug.Log ("材质球shader替换成(Standard)");
            re.material.shader = Shader.Find ("Standard");
        }
    }
}

你可能感兴趣的:(简单使用)