public static void Rewrite(ref Texture2DArray texArr, Texture2DArray newArr)
        {
                        #if UNITY_EDITOR
            bool isSelected = UnityEditor.Selection.activeGameObject == texArr;

            UnityEditor.AssetImporter texImporter = texArr.GetImporter();
            if (texImporter == null)
            {
                return;
            }

            //string userData = texImporter.userData; //do not owerwrite userdata
            UnityEditor.EditorUtility.CopySerialized(newArr, texArr);
            UnityEditor.EditorUtility.SetDirty(texArr);
            UnityEditor.AssetDatabase.SaveAssets();

            if (isSelected)
            {
                UnityEditor.Selection.activeObject = texArr;
            }


            //texArr = UnityEditor.AssetDatabase.LoadAssetAtPath<Texture2DArray>(path);
            //texArr.GetImporter().userData = userData;
                        #endif
        }