using TMPro; using UnityEngine; using UnityEngine.UI; namespace AibisDream.Test { public class OptionTest : MonoBehaviour { private GameObject panel; private GameObject prefab; private GameObject[] buttonGroup; private YarnOption[] _options; void Start() { // 初始化时注册Command // 第一个参数为[command name=xxx]的参数 // 第二个参数是注册的函数,在Yarn走到选择项时触发 DialogController.Instance.RegisterPauseCommand("show_buttons", ShowButtons); // 不重要 panel = transform.GetChild(0).gameObject; prefab = Resources.Load("Prefabs/UI/Choice Button"); } public void ShowButtons(YarnContinueStep step) { var option = step; var instance = Instantiate(prefab, panel.transform, true); var textMesh = instance.GetComponentInChildren(); textMesh.text = "继续对话"; instance.GetComponent