0

现在在我的着色器中,我有 5 个纹理,

 Properties
     {
         _MainTex ("Texture", 2D) = "white" {}
         _MainTex2("Texture2", 2D) = "white" {}
         _MainTex3 ("Texture3", 2D) = "white" {}
             _MainTex4 ("Texture4", 2D) = "white" {}
             _MainTex5 ("Texture5", 2D) = "white" {}
     }

有没有可能我可以把它变成一个数组,这样我就不需要声明这么多纹理了?

4

1 回答 1

1

您可以使用2DArray允许您这样做的类型。

Properties
{
    _TheTextureArray ("Tex", 2DArray) = "" {}
}

您可以在此处找到有关它的更多信息:https ://docs.unity3d.com/Manual/SL-TextureArrays.html

请注意技术限制(例如,DX11/12),因此默认情况下它不适用于所有环境,当然不是网络(当前)。

于 2016-10-12T06:14:23.747 回答