using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Question : MonoBehaviour { public int index;//玩家选择的答案记录 int rand;//随机的结果 public string[] questionInfo; Toggle tg; void Start() { tg = GetComponent(); rand = Step2_3.rand; transform.GetChild(1).GetComponent().text = questionInfo[rand]; tg.onValueChanged.AddListener((bool value) => { if (value) { EventManager.Instance.emit("Question", index); } }); } }