Argument `#1' cannot convert `Shader' expression to type `UnityEngine.Shader'

Hey guys.

So I’m trying to implement an effect into my Unity game. I have been learning shaders and stumbled upon the camera.RenderWithShader function.

Here is my script

using UnityEngine;
using System.Collections;

public class Shader : MonoBehaviour {

	public Shader heatVisionShader;
    void Example() {
        camera.RenderWithShader(heatVisionShader, "VisibleWithHeatVision");
    }
}

Upon compile I get an “Argument #1' cannot convert Shader’ expression to type `UnityEngine.Shader’” error. What is the issue?

This is not a ShaderLab-relevant issue. You named your class Shader. If you do that, you have to put it in its own namespace, or explicitly type heatVisionShader as UnityEngine.Shader.

That said, I really doubt you should have named this class Shader. Come up with a better name.

That, and Unity doesn’t seem to be all that friendly to custom namespaces.