public void LoadQuestion2(int id = -1) { if (Question2List.Count == 0 || id > Question2List.Count) { print("Question2 list too small or empty"); return; } if (id == -1) { id = Random.Range(0, Question2List.Count); } activeQuestion2 = Question2List[id]; Question2Text.text = activeQuestion2.Question2Text; for (int i = 0; i < buttons.Count; i++) { if (i >= activeQuestion2.Answers.Count) { buttons[i].SetActive(false); } else { buttons[i].SetText(activeQuestion2.Answers[i]); } } }
void Start() { MS_Question2 q1 = new MS_Question2 { Question2Text = "Hvilken er blå?", Answers = { "Blå", "Grønn", "Gul", "Rød", "Lilla" } }; q1.RandomizeAnswerPositions(); AddQuestion2(q1); LoadQuestion2(0); }
public void AddQuestion2(MS_Question2 Question2) { Question2List.Add(Question2); }