Is it possible to retrieve a Texture2DArray from a material i C#? we can get ColorArray, FloatArray, MatrixArray and VectorArray, any reason why not Texture2DArray? Is there any know work around for this? thanks.
Are you asking why there's no GetTexture2DArray function? Because GPUs don't support arrays of textures. A Texture2DArray is a "single texture object" that just happens to have a third dimension, like a Texture3D. Both of those and Texture2D use the Texture class as their parent, and that's what the SetTexture / GetTexture functions take. So to get a Texture2DArray from a material, you just need to call GetTexture with the appropriate property name.
@bgolus you are a hero sir! for anyone looking to do this here's a small snippet example: Code (CSharp): private void Start() { Material mat = GetComponent<MeshRenderer>().material; texture2DArray = mat.GetTexture("_NameOfArrayInShader") as Texture2DArray; for (int i = 0; i < texture2DArray.depth; i++) { Color32[] pixels = texture2DArray.GetPixels32(i, 0); Texture2D texture = new Texture2D(texture2DArray.width, texture2DArray.height); texture.SetPixels32(pixels); texture.Apply(); textures.Add(texture); //List of Texture2D } }