Hi all, I'm a beginner with the Unity UI system, and I'd like to do buttons. The slicing system, using sprite mode multiple and adding borders is very interesting for buttons, and windows, popups etc. However I'm not fully satisfied with it and I wonder if there is a way to tweak it's behaviour.
For now, the corner parts are not resized, which is perfect but the other parts are stretched. I'm trying to make an UI with an old fashionned parchment style, and stretching it too much is very ugly. I'd like to make it tile instead, as you can do in the nintendoware UI editor for instance.
Is there an option somewhere in unity to fix that behavior? Plugins ? Or should it be fixed with code?
Thanks for your help!
Replies
- Set your asset to Texture type: Sprite (2D and UI)
- Select sprite mode : Multiple
- Click on sprite editor and add your borders (the blue borders should enveloppe the whole image and the green ones slice along the borders)
- Then attribute your sprite to any UI element in your scene you want (panel, button, etc)
- On that element you've got a component Image (Script), change the Image Type there to tiled. Your asset will tile properly according to the borders you've set previously instead of stretching (the default behaviour)