现在在我的着色器中,我有5个纹理,
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainTex2("Texture2", 2D) = "white" {}
_MainTex3 ("Texture3", 2D) = "white" {}
_MainTex4 ("Texture4", 2D) = "white" {}
_MainTex5 ("Texture5", 2D) = "white" {}
}
有可能我可以把它变成一个数组,这样我就不需要声明那么多纹理吗?
答案 0 :(得分:1)
您可以使用2DArray
类型来执行此操作。
Properties
{
_TheTextureArray ("Tex", 2DArray) = "" {}
}
您可以在此处找到有关它的更多信息:https://docs.unity3d.com/Manual/SL-TextureArrays.html
请注意技术限制(例如,DX11 / 12),因此默认情况下它不适用于所有环境,当然也不适用于网络(当前)。