[Unity]ShaderLab开关属性:[ToggleOff]
2020/09
17
00:09
ToggleOff用法在官方文档中并没有提及,以下为使用方法
1、声明Property,格式为:[ToggleOff] VarName("Display", Int) = 0/1
例如:
Properties
{
[ToggleOff] _EnableColor_Attr("_EnableColorAttr", Int) = 1
}
// 2、声明ShaderFeature,格式为: #progma shader_feature VARNAME_OFF
例如:
#pragma shader_feature _ENABLECOLOR_ATTR_OFF
// 3、使用,直接用 #if defined(VARNAME_OFF)
例如:
#if defined(_ENABLECOLOR_ATTR_OFF)
#endif
注意,声明ShaderFeature和使用宏,均需要全大写并加_OFF后缀
CopyRights: The Post by BY-NC-SA For Authorization,Original If Not Noted,Reprint Please Indicate From 老刘@开发笔记
Post Link: [Unity]ShaderLab开关属性:[ToggleOff]
Post Link: [Unity]ShaderLab开关属性:[ToggleOff]