public void DeleteWordImages(List <int> deleteIndices, string word) { foreach (int idx in deleteIndices) { Debug.Log("Index number is " + idx); if (idx < wordImageNames.Capacity && wordImageNames[idx] != null) { // Add the file name to the delete names hash set for deletion toDelete.Add(wordImageNames[idx]); Debug.Log("*****\n wordImageNames entry is: " + wordImageNames[idx] + ""); // Grab a ref to the texture to be deleted imagesForDelete.Add(textureList[idx]); } Debug.Log("removed from TEXTURELIST"); } if (toDelete.Count > 0) { for (int x = 0; x < toDelete.Count; x++) { wordImageNames.Remove(toDelete[x]); textureList.Remove(imagesForDelete[x]); } Debug.Log("to DELETE WAS NOT COUNT ZERO"); FileAccessUtil.DeleteWordPictures(toDelete, word); //Clear the the temporary delete lists toDelete.Clear(); imagesForDelete.Clear(); } }