public void OnDeleteArea(GameObject go) { var entry = go.GetComponent <MultipleChoiceAreaEntry>(); toggleGroup.UnregisterToggle(entry.toggle); File.Delete(entry.miniatureUrl); answerAreas.Remove(entry.area); toggleGroup.UnregisterToggle(go.GetComponentInChildren <Toggle>()); Destroy(go); var toggles = toggleGroup.GetAllToggles(); for (int i = 0; i < toggles.Count; i++) { if (toggles[i].isOn) { answerCorrect = i; } } }
public void DeleteAlbumEntry(GameObject go) { var entry = go.GetComponent <MultipleChoiceImageEntry>(); entries.Remove(entry); toggleGroup.UnregisterToggle(go.GetComponentInChildren <Toggle>()); Destroy(go); var toggles = toggleGroup.GetAllToggles(); for (int i = 0; i < toggles.Count; i++) { if (toggles[i].isOn) { answerCorrect = i; } } }