using AX.MessageSystem; using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using UnityEngine.UI; public class FourthGPanel : MonoBehaviour { public ButtonRecordByAC CloseButton; // Use this for initialization void Awake () { MessageDispatcher.AddListener("OpenFourthG", ShowOrHidePanel); gameObject.SetActive(false); } private void OnDestroy() { MessageDispatcher.RemoveListener("OpenFourthG", ShowOrHidePanel); } void Start() { CloseButton.OutInterFaceButton = closeClick; } private void closeClick() { //FindObjectOfType().GetComponent().isOn = false; GameObject.Find("4GPictureToggle").GetComponent().isOn = false; gameObject.SetActive(false); } // Update is called once per frame void Update () { } void ShowOrHidePanel(IMessage obj) { var isOn = (bool)obj.Data; gameObject.SetActive(isOn); } }