private void showQuestion() { foreach (GameObject obj in GameObject.FindGameObjectsWithTag("QuestionBall")) { QuestionBall q = obj.GetComponent <QuestionBall> (); foreach (TextMeshProUGUI text in obj.GetComponentsInChildren <TextMeshProUGUI> ()) { text.SetText(q.question.question.ToString()); } } }
public void go() { foreach (GameObject obj in GameObject.FindGameObjectsWithTag("QuestionBall")) { QuestionBall q = obj.GetComponent <QuestionBall> (); if (q.question.verify(answer)) { playSfx(ballExplodeSfx); score += q.question.score; scoreTxt.text = (score).ToString(); Debug.Log(q.question.explaination + ", Score " + q.question.score); clear(); Destroy(obj); // StartCoroutine(delayDestroy (obj)); return; } } badAnswer(); }