using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class OffCeShi : MonoBehaviour { public Button CeShiButton; public GameObject[] CeShiGameObject; // Start is called before the first frame update void Start() { CeShiButton.onClick.AddListener(Open); } public void Open() { if (CeShiGameObject[0].activeSelf) { foreach (var item in CeShiGameObject) { item.SetActive(false); } } else { foreach (var item in CeShiGameObject) { item.SetActive(true); } } } }