Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
【Unity】カメラ画面内のShaderを置き換える【ShaderReplacement】
using UnityEngine;
public class ShaderReplace : MonoBehaviour {
public Shader replaceShader;
void Update () {
if(Input.GetKey(KeyCode.A))
{
//カメラ画面内の全てのShaderが「replaceShader」に置き換わる。
Camera.main.SetReplacementShader(replaceShader, null);
//Tag内に"Hoge"があるshaderのみが「replaceShader」に置き換わる。それ以外は描画もされない。
//Camera.main.SetReplacementShader(replaceShader, "Hoge");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment