0
votes

Right now in my shader, I have 5 textures,

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

Is that possible I can make it an array so that I dont need to declare so many textures?

1
Did you see this? - Droppy
Was about to answer the same, but since this is the answer, which will help future viewers, I'll create an answer from this. - Riaan Walters

1 Answers

1
votes

You can use the 2DArray type which will allow you to do so.

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

You can find more information about it here : https://docs.unity3d.com/Manual/SL-TextureArrays.html

Please do take note of the tech limitations (example, DX11/12) so it will not work on all environments by default, certainly not the web (currently).