IEnumerator FocusConstellation(RaycastHit focustarget) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); int layerMask = 1 << LayerMask.NameToLayer("Constellation"); Constellation temp = focustarget.collider.GetComponent <Constellation>(); Explanation explanation = focustarget.collider.GetComponent <Explanation>(); temp.FadeStart(); explanation.FadeStart(); while (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask)) { ray = Camera.main.ScreenPointToRay(Input.mousePosition); yield return(null); } Debug.Log("FocusOff"); temp.FadeReset(); explanation.FadeReset(); focusOn = false; }