Search Unity

Filling a sliced box with a background color

Discussion in 'UGUI & TextMesh Pro' started by Zephus, Mar 27, 2017.

  1. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    I want to fill this box, which I set to 'Sliced' with the color shown in the center:


    I've tried using a Mask, but I can't seem to find a way to only fill the box and nothing else.
    If I just stretch the Image the corners outside of the box will also be filled. If I make the box smaller I can't fill every pixel of the box.

    I need the two to be separate images because I want to make the background color transparent and the box not.

    Any suggestions?
     
  2. Akfly

    Akfly

    Joined:
    Jan 31, 2017
    Posts:
    12
    You could put a white image with rounded corners as the background (and set to sliced too), then stretch it to the sides and tint it with the color you want.
     
  3. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    That worked, thank you.