Example #1
0
    public static Rect GetWorldRect(this RectTransform transform)
    {
        transform.GetWorldCorners(_worldRectCache);

        /*for (int i = 0; i < _worldRectCache.Length; i++)
         * {
         *  var vector3 = _worldRectCache[i];
         *  UIDebug.Point("worldpoint"+i, vector3, Color.blue, 10);
         * }*/

        var rect = new Rect(_worldRectCache[0], Vector2.zero);

        rect = RectExtensions.Encapsulate(rect, _worldRectCache[2]);
        rect = RectExtensions.Encapsulate(rect, _worldRectCache[1]);
        rect = RectExtensions.Encapsulate(rect, _worldRectCache[3]);
        return(rect);
    }