private void Start() { canavs = GetComponent <Canvas>(); rayCastCamera = FindObjectOfType <JMRUIRayCastCamera>(); if (canavs.renderMode == RenderMode.WorldSpace) { canavs.worldCamera = rayCastCamera.GetRayCastCamera(); } }
/// <summary> /// Set the UI raycast camera as event camera in canvas /// </summary> private void SetRaycastCameraToCanvas() { JMRUIRayCastCamera jmrRaycastCamera = FindObjectOfType <JMRUIRayCastCamera>(); if (jmrRaycastCamera != null) { j_Canvas.worldCamera = jmrRaycastCamera.GetRayCastCamera(); } }
/// <summary> /// Set the UI raycast camera as event camera in canvas /// </summary> IEnumerator SetRaycastCameraToCanvas() { JMRUIRayCastCamera jmrRaycastCamera = null; do { yield return(new WaitForEndOfFrame()); jmrRaycastCamera = FindObjectOfType <JMRUIRayCastCamera>(); } while (!jmrRaycastCamera); j_Canvas.worldCamera = jmrRaycastCamera.GetRayCastCamera(); }
private void SetRaycastCameraToCanvas(Canvas j_Canvas) { if (!j_Canvas) { //Debug.LogError("Cannot find Canvas component to process"); return; } if (!j_JMRRaycastCamera) { j_JMRRaycastCamera = FindObjectOfType <JMRUIRayCastCamera>(); } if (j_JMRRaycastCamera != null) { j_Canvas.worldCamera = j_JMRRaycastCamera.GetRayCastCamera(); } }