private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = cam.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider != null) { TVScreen tvScreen = hit.collider.gameObject.GetComponent <TVScreen>(); if (tvScreen != null) { UIMain.Instance.OnTvClicked(tvScreen.id); } } } } }