void RefreshDeleteSaves() { Delete.DeactivateAll(); foreach (var saveFile in SaveFiles.GetSaves()) { var obj = Delete.GetPooledObject(); obj.GetComponentInChildren <Text>().text = saveFile.FileNameWithoutExt; var btn = obj.GetComponentInChildren <Button>(); btn.onClick.RemoveAllListeners(); btn.onClick.AddListener(() => { SaveFiles.DeleteSave(saveFile); Refresh(); }); obj.SetActive(true); } }
void DeleteSave(SaveFile save) { SaveFiles.DeleteSave(save); RefreshSaveFiles(); ResetAllButtonColors(); }