using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class MainNav : MonoBehaviour { private void Awake() { var material = Instantiate(Resources.Load("UI/Material/RoundedCornersTextureMaterial")); var rect = ((RectTransform)this.transform).rect; material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0)); this.GetComponent().material = material; var wifi = this.transform.Find("Wifi"); UIManager.AddEvent(wifi.gameObject, EventTriggerType.PointerClick, x => { Debug.Log("click wifi"); UIManager.ShowDevicePanel(); }); var home = this.transform.Find("Home"); UIManager.AddEvent(home.gameObject, EventTriggerType.PointerClick, x => { UIManager.ShowHomePanel(); }); } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } }