public void Tick()
 {
     if (m_CachedCamera == null)
     {
         m_CachedCamera = Camera.main;
     }
     m_Output.SetValue(CalculateMatrix());
     m_ScreenRect.SetValue(m_CachedCamera.pixelRect);
 }
        private void CalculateRect(UIEventData eventData)
        {
            if (eventData.EventType == UIEventType.Layout)
            {
                var parentRect = eventData.Rect;
                var outRect    = new Rect
                {
                    x      = m_AnchorMin.x * parentRect.width + m_OffsetMin.x,
                    y      = m_AnchorMin.y * parentRect.height + m_OffsetMin.y,
                    width  = m_AnchorMax.x * parentRect.width - m_OffsetMax.x - m_AnchorMin.x * parentRect.width - m_OffsetMin.x,
                    height = m_AnchorMax.y * parentRect.height - m_OffsetMax.y - m_AnchorMin.y * parentRect.height - m_OffsetMin.y
                };

                m_OutRect.SetValue(outRect);
            }
        }