using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class APISon : UIController { [SerializeField] Button Btn; public APIWindows windows2; int sum = 1; public string data = "创建机器人,方法:CREATE,参数:无参,重载:2重载,返回值:无返回值,类:SZPT"; public string name; [SerializeField] TextMeshProUGUI text; // Start is called before the first frame update void Start() { init(); } void init() { Btn.onClick.AddListener(() => { try { if (sum % 2 != 0) { windows2.gameObject.SetActive(true); windows2?.init(data); } else { windows2.gameObject.SetActive(false); } sum++; } catch (System.Exception ex) { Debug.Log(ex.Message); } }); if (text != null) { text.text = name; } } }