I’m a beginner UI Designer, and I’m working on some simple UI.
I have a pretty simple question. How do you add a border to rounded UI? I’ve done some research on this, but I haven’t found anything yet.
The one on the left is made using UIStrokes, while the one on the right is done without using UIStrokes. I’m trying to recreate it without using UIStrokes.
I think you can see the problem here. Even though I’ve positioned the inner frame to be at the middle of the outer frame, it offsets the position for some reason. The inner frame’s Anchor Point is 0.5, 0.5 and the position is 0.5, 0, 0.5, 0.
Any help is appreciated. Thanks for taking the time to read this!
It should work fine just by setting the UICorner radius of both frames to the same value (that is, if you’re using scale for your corner radius and not offset). I was able to do so using two frames with identical UICorner instances, and the nested frame using the same AnchorPoint/Position properties you mentioned:
Alternatively if you want to use offset to set your UICorner radius parameters you can set the nested frame’s corner radius to the parent frame’s radius multiplied by the scale size of the nested frame. For example, if your parent frame (dark blue/purple) has a UICorner radius of {0, 24}, and your nested frame (light blue) is set to a size of {0.9, 0}, {0.9, 0}, your nested frame’s UICorner radius should be {0, 24*0.9}.
Overall it’d probably be better to just use UIStroke imo but if you’re looking to use a nested frame instead I don’t see any reason why setting the parameters in this way wouldn’t work.
If your testing the game using the built in device emulator, make sure you set it to be on resolution. That could be what causes it to look like that. Otherwise, I’m not too sure
The only time I’ve noticed issues like that happening are when I have the device emulator enabled (like @iGiDgames mentioned) and the scaling mode set to “Fit to Window” (if you do, try turning off the device emulator and seeing how it looks). Otherwise, I’m not exactly sure what would be causing a one pixel offset like what you’re seeing.