- Home /
How to stretch top and bottom portions of a sprite without stretching the middle...,Stretching the top and bottom portions of a sprite without stretching the middle...
Hi! I would like to use a sprite for a button that runs along the vertical edge of the screen. I have uploaded an image of the sprite - I hope it is viewable. It resembles the tab of a folder.
Anyway, when applying this sprite to the vertically-stretched button, the "tab" in the middle also stretches to fit the vertical edge. I would like for the tab to remain unchanged while the top and bottom portions stretch. How can I do this?
[1]: /storage/temp/128480-tab-sprite.png
Answer by Vega4Life · Nov 28, 2018 at 12:48 AM
You should try slicing your sprites, so they can be stretched the way you want them to.
https://docs.unity3d.com/Manual/9SliceSprites.html
Sprite-slicing is the first solution I tried. However, I could not get those slices quite right. I need the top and bottom sections to stretch, not the middle. The slicing on Unity stretches the middle, however.
Been a while. Have you figured out how to do this? I have the same problem right now.
Your answer
![](https://koobas.hobune.stream/wayback/20220612182912im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I have an array in Unity. I want to assign an image based on the gameobject's tag 1 Answer
Matching the size of UI elements with that of world objects 0 Answers
Check if UI element is fully inside another UI element 1 Answer
Change UI GUI Image Sprite at runtime .. Unity 5 .. js 1 Answer
UI Image size 1 Answer