Search Unity

Stretching certain part of a sprite (like ui)

Discussion in '2D' started by ahmadian, Sep 26, 2016.

  1. ahmadian

    ahmadian

    Joined:
    Nov 24, 2015
    Posts:
    44
    I want to have a line with two arrows at each end , and I want to give it an end point and start point and have it stretched between the two point but I don't want to mess up the arrows. I know we can do it by split sprites in ui image but how can I achieve this with sprite renderer?
     
  2. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    SpriteRenderer cannot be 9-Sliced right now. This is something that will be coming in future updates I believe.

    One option is to have 3 sprites, one for each end, and one for the middle. Then either stretch the middle one and reposition the ends to the edges of the stretched sprite, or stretch the middle one to fit between the two ends wherever they are, and then move the ends around. Same effect, it's just which one is dependent on the other.
     
    Last edited: Sep 26, 2016
    JoeStrout likes this.
  3. ahmadian

    ahmadian

    Joined:
    Nov 24, 2015
    Posts:
    44
    Thank you
    I had that idea , I was just wondering if there is an easier way to do this :D