Example #1
0
        /// <summary>
        /// Draw the Image preview.
        /// </summary>

        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            RawImage rawImage = target as RawImage;
            Texture  tex      = rawImage.mainTexture;

            if (tex == null)
            {
                return;
            }

            var outer = Outer(rawImage);

            SpriteDrawUtility.DrawSprite(tex, rect, outer, rawImage.uvRect, rawImage.canvasRenderer.GetColor());
        }
        /// <summary>
        /// Draw the Image preview.
        /// </summary>

        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            Image image = target as Image;

            if (image == null)
            {
                return;
            }

            Sprite sf = image.sprite;

            if (sf == null)
            {
                return;
            }

            SpriteDrawUtility.DrawSprite(sf, rect, image.canvasRenderer.GetColor());
        }