public static void LinkTexture(string texGuid, string arrGuid, bool isAlpha = false)
        {
                        #if UNITY_EDITOR
            string userDataTag = "TexArr_textureArray_as" + (isAlpha? "Source" : "Alpha");
            UnityEditor.AssetImporter importer = AssetsExtensions.GetImporter(texGuid);

            if (importer == null)
            {
                Debug.Log("Could not get importer for " + UnityEditor.AssetDatabase.GUIDToAssetPath(texGuid) + " to assign texture");
                return;
            }

            string[] texData = AssetsExtensions.GetUserData(importer, userDataTag);
            if (!texData.Contains(arrGuid))             //not already signed as used
            {
                ArrayTools.Add(ref texData, arrGuid);
                AssetsExtensions.SetUserData(texGuid, userDataTag, texData, reload: false);
            }

            //writing hash for the newly assigned textures
            string    path    = UnityEditor.AssetDatabase.GUIDToAssetPath(texGuid);
            Texture2D tex     = UnityEditor.AssetDatabase.LoadAssetAtPath <Texture2D>(path);
            string    texHash = tex.GetHash().ToString();                                            //tex.imageContentsHash.ToString();
            AssetsExtensions.SetUserData(importer, "Hash", new string[] { texHash }, reload: false); //will write only if hash changed
                        #endif
        }
        public static void UnlinkTexture(string texGuid, string arrGuid, bool isAlpha = false)
        {
                        #if UNITY_EDITOR
            string userDataTag = "TexArr_textureArray_as" + (isAlpha? "Source" : "Alpha");
            UnityEditor.AssetImporter importer = AssetsExtensions.GetImporter(texGuid);

            if (importer == null)
            {
                Debug.Log("Could not get importer for " + UnityEditor.AssetDatabase.GUIDToAssetPath(texGuid) + " to unassign texture");
                return;
            }

            string[] prevTexData = AssetsExtensions.GetUserData(importer, userDataTag);
            if (prevTexData == null || prevTexData.Length == 0)
            {
                //Debug.Log("Previous texture has no data assigned");
                return;
            }
            ArrayTools.RemoveAll(ref prevTexData, arrGuid);
            AssetsExtensions.SetUserData(importer, userDataTag, prevTexData, reload: false);
                        #endif
        }