Make a shader that lets me swap between lambert and unlit
I am trying to find a way to have in the same shader both options of Unlit and normal Diffuse, but i can't find them anywhere. IT does not really need to be inside a boolean, it could be triggered in any way, but i can't just figure it out. This is sort of what i want to do, this does not compile unless you remove the if statement:
Shader "LitAndDiffuseShader"
{
Properties
{
_Color("Color", Color) = (1,1,1)
[MaterialToggle] _noLight("NoLight", Float) = 0
[NoScaleOffset] _MainTex("Diffuse", 2D) = "black" { }
}
SubShader
{
Lighting On
Material
{
Ambient[_Color]
Diffuse[_Color]
}
Pass
{
if (_NoLight == 1)
{
//NoLight
SetTexture[_MainTex]
}
else
{
//Diffuse
SetTexture[_MainTex]{ Combine texture * primary Double }
}
}
}
I know booleans are inefficent, but this does not even compile, i was wondering if there is any way to do this, but i can' find it anywhere. This obviously does not compile because shaderlab does not let me do ifs, but i was looking for an alternative somewhere... Thanks in advance!
Your answer

Follow this Question
Related Questions
How to change this Shader lit to unlit? 1 Answer
Unlit shader not showing color in main preview 0 Answers
Unlit unity terrain 1 Answer
[HELP!!!!] ProjectorMultiPlyMask Shader add Unlit 0 Answers
Half Lambert / Wrap Diffuse Shader 0 Answers