/// <summary>
        /// Gets Unity Material from Daggerfall terrain using texture arrays.
        /// </summary>
        /// <param name="archive">Archive index.</param>
        /// <returns>Material or null.</returns>
        public Material GetTerrainTextureArrayMaterial(int archive)
        {
            // Ready check
            if (!IsReady)
            {
                return(null);
            }

            // Return from cache if present
            int key = MakeTextureKey((short)archive, (byte)0, (byte)0, TileMapKeyGroup);

            if (materialDict.ContainsKey(key))
            {
                CachedMaterial cm = GetMaterialFromCache(key);
                if (cm.filterMode == MainFilterMode)
                {
                    // Properties are the same
                    return(cm.material);
                }
                else
                {
                    // Properties don't match, remove material and reload
                    materialDict.Remove(key);
                }
            }

            // Generate texture array
            Texture2DArray textureArrayTerrainTiles              = textureReader.GetTerrainTextureArray(archive, TextureMap.Albedo);
            Texture2DArray textureArrayTerrainTilesNormalMap     = textureReader.GetTerrainTextureArray(archive, TextureMap.Normal);
            Texture2DArray textureArrayTerrainTilesParallaxMap   = textureReader.GetTerrainTextureArray(archive, TextureMap.Height);
            Texture2DArray textureArrayTerrainTilesMetallicGloss = textureReader.GetTerrainTextureArray(archive, TextureMap.MetallicGloss);

            textureArrayTerrainTiles.filterMode = MainFilterMode;

            Shader   shader   = Shader.Find(_DaggerfallTilemapTextureArrayShaderName);
            Material material = new Material(shader);

            material.name = string.Format("TEXTURE.{0:000} [TilemapTextureArray]", archive);

            material.SetTexture(TileTexArrUniforms.TileTexArr, textureArrayTerrainTiles);
            if (textureArrayTerrainTilesNormalMap != null)
            {
                // If normal map texture array was loaded successfully enable _NORMALMAP in shader and set texture
                material.SetTexture(TileTexArrUniforms.TileNormalMapTexArr, textureArrayTerrainTilesNormalMap);
                material.EnableKeyword(KeyWords.NormalMap);
                //textureArrayTerrainTilesNormalMap.filterMode = MainFilterMode;
            }
            if (textureArrayTerrainTilesParallaxMap != null)
            {
                // If parallax map texture array was loaded successfully enable _PARALLAXMAP in shader and set texture
                material.SetTexture(TileTexArrUniforms.TileParallaxMapTexArr, textureArrayTerrainTilesParallaxMap);
                material.EnableKeyword(KeyWords.HeightMap);
                //textureArrayTerrainTilesParallaxMap.filterMode = MainFilterMode;
            }
            if (textureArrayTerrainTilesMetallicGloss != null)
            {
                // If metallic gloss map texture array was loaded successfully enable _METALLICGLOSSMAP in shader and set texture
                material.SetTexture(TileTexArrUniforms.TileMetallicGlossMapTexArr, textureArrayTerrainTilesMetallicGloss);
                material.EnableKeyword(KeyWords.MetallicGlossMap);
                material.SetFloat(Uniforms.Smoothness, 0.35f);
                //textureArrayTerrainTilesMetallicGloss.filterMode = MainFilterMode;
            }

            CachedMaterial newcm = new CachedMaterial()
            {
                key        = key,
                keyGroup   = TileMapKeyGroup,
                material   = material,
                filterMode = MainFilterMode,
            };

            materialDict.Add(key, newcm);

            return(material);
        }