How do you set a boolean for a shader? How do you write a conditional or assign a boolean in a shader?
So, it seems that shaders do not take booleans... so I tried assigning the float to 0 or 1 ren.material.SetFloat("_ZWriteVal", 1f);
, but it doesn't seem to work...
Shader "ZTestLess"
{
Properties {
_Color ("Color", Color) = (0,0,0)
[Toggle(Z_WRITE_VAL)]
_ZWriteVal("Z Write Val", Float) = 0
}
SubShader
{
Tags { "Queue" = "Background" }
Pass
{
CGPROGRAM
#pragma shader_feature Z_WRITE_VAL
#ifdef Z_WRITE_VAL
ZWrite On
#else
ZWrite Off
ZTest Less
Color [_Color]
Lighting Off
ENDCG
}
}
}
Int
instead? \$\endgroup\$