/// author:Saber /// desc:用来对摄像机中的对象进行替换渲染 using System.Collections; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] public class ChangeShaderRender : MonoBehaviour { private Camera m_camera; [SerializeField] public Shader target_shader; // Start is called before the first frame update void Start() { m_camera = this.gameObject.GetComponent(); } // Update is called once per frame void LateUpdate() { if(target_shader != null){ m_camera.RenderWithShader(target_shader, "RenderType"); } } }