I’m working on my inventory menu and wanted to reuse the same button for different applications. The button is pretty simple and is inspired by the “UI Lab” approach of driving it using a material:
The material is drawn as a box with margins set to zero.
However, no matter how I’m configuring the margin and the draw-as, I can’t get it to look good on smaller buttons:
Corners are stretched, and the line thickness is also wrong.
My goal is to keep the corners at 45° and keep the contour line thickness like the original. How can I achieve this?
The material is drawn as a box with margins set to zero. However, no matter how I’m configuring the margin and the draw-as, I can’t get it to look good on smaller buttons:
Can you show how it’s set up, and what are the sizes we’re talking about? The thing is that 9-slice only works up, you want to design the smallest possible UI elements first, and only then stretch them, preserving edges / corners intact.
Material responds to Image Size, it might be as straightforward as reducing its size on the ButtonMaterial. Then margins work like percentage in the 0-1 range, counting from each edge.
size set to 32 (smaller or equal to the px size of this element):
Yeah, ideally it should be a square. This shape would be awkward to work with when the target widget is square shaped. Probably doable with dynamic margins but fiddly! Make it the smallest, most compact shape is should ever be and work up in order to stretch it. Never try to compress it.
For something like this mockup:
You could probably get away with all margins set to .25. If they still distort at the smallest size, try .3.
Avoid .5 or higher unless you’re opting for something truly unorthodox.
I’ll try tonight to build my button 100% from paterial and see what I can get from here rather than using textures. I should have more control over some basic parameters, and I’ll be able to draw it as a square. I’ll let you know, and many thanks for your help!