Texture2DArray Surface Sampling problems

Hi, I am testing the Texture2DArray and for the life of me I couldn’t make the sampling work in the Surface shader, it compiles with no problem using #ifndef SHADER_TARGET_SURFACE_ANALYSIS, but the uv seems to be always turn to float(1,1), even as the uv works with regular tex2D sampling.

To make it visual the following sampling returns the next image.

o.Albedo =tex2D (_myTexture, IN.uv_MyArray);

And the same applies to this:

#ifndef SHADER_TARGET_SURFACE_ANALYSIS
              o.Albedo = UNITY_SAMPLE_TEX2DARRAY(_MyArray,float3(IN.uv_MyArray,0));
          #endif

You can remove the whole SHADER_TARGET_SURFACE_ANALYSIS check, if you’re using 5.4 beta15 or later. That should work without problems.

The reason for your thing is that the “what is actually needed by the surface shader” analysis step now thinks that “hey, UV of _MyArray is not used, so let’s not generate code for it”.