0

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?

2
  • 1
    Did you see this? Commented Oct 12, 2016 at 6:04
  • Was about to answer the same, but since this is the answer, which will help future viewers, I'll create an answer from this. Commented Oct 12, 2016 at 6:16

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.