"Material doesn't have a ... property" 使用超过 3 个 2D 纹理时
"Material doesn't have a ... property" when using more than 3 2D Textures
我写了多个fixed function Shaders
。我注意到一旦着色器包含超过 3 个 2D 纹理,着色器就会中断并统一报告每个 属性 的 Material doesn't have a ... property
... material 有。例如:
Shader "Custom/JustAnotherShader" {
Properties{
_MainTex("Base (RGB)", 2D) = "white" { }
_TexA("Another Texture", 2D) = "black" { }
_TexB("Yet Another Texture", 2D) = "" { }
_TexC("One More Another Texture", 2D) = "" { }
}
SubShader {
Pass {
SetTexture[_MainTex] { combine texture }
SetTexture[_TexA] { combine texture * previous }
SetTexture[_TexB] { combine texture + previous }
SetTexture[_TexC] { combine texture - previous }
}
}
Fallback Off
}
此代码将为 _MainTex
、_TexA
、_TexB
和 _TexC
报告此错误。这似乎是一个错误。如何解决这个问题?
经过一些研究,我现在可以得出结论,我正在使用的着色器编译目标不支持三个以上的纹理。 (不幸的是,我丢失了描述此限制的文档的 link。)
我写了多个fixed function Shaders
。我注意到一旦着色器包含超过 3 个 2D 纹理,着色器就会中断并统一报告每个 属性 的 Material doesn't have a ... property
... material 有。例如:
Shader "Custom/JustAnotherShader" {
Properties{
_MainTex("Base (RGB)", 2D) = "white" { }
_TexA("Another Texture", 2D) = "black" { }
_TexB("Yet Another Texture", 2D) = "" { }
_TexC("One More Another Texture", 2D) = "" { }
}
SubShader {
Pass {
SetTexture[_MainTex] { combine texture }
SetTexture[_TexA] { combine texture * previous }
SetTexture[_TexB] { combine texture + previous }
SetTexture[_TexC] { combine texture - previous }
}
}
Fallback Off
}
此代码将为 _MainTex
、_TexA
、_TexB
和 _TexC
报告此错误。这似乎是一个错误。如何解决这个问题?
经过一些研究,我现在可以得出结论,我正在使用的着色器编译目标不支持三个以上的纹理。 (不幸的是,我丢失了描述此限制的文档的 link。)