private void Update() { base.Update(); RaycastHit hit; if (Physics.Raycast(pointer.transform.position, pointer.transform.TransformDirection(Vector3.forward), out hit)) { Debug.DrawRay(pointer.transform.position, pointer.transform.TransformDirection(Vector3.forward), Color.blue); GameObject hitObject = hit.transform.gameObject; MenuUI menObj = hitObject.GetComponent <MenuUI>(); if (menObj) { Debug.Log("Point At Button"); menObj.GetSelected(); } } if (coolNow > 0) { coolNow -= Time.deltaTime; } }