Consistent rect outline thickness and corner roundness

I was playing around with the new UGUI Shaders Samples and I have several questions.

  1. How do I achieve consistent outline thickness and corner roundness for rectangles? I’m using rectangle subgraph. Here you can see that depending on the aspect ratio (or something else idk) we have dramatically different results with the same material. I understand that it happening probably because of streched/scaled uvs but for now I don’t know how to fix it.

  2. Suggestion - add an option for outlines to be outside/inside/center.

  3. Is “RectTransform size” component from this sample pack production ready? There is a problem with it when you try to input size values into the rect transform.

  4. Shaders for text?

These are good suggestions.

Consistent line thickness regardless of element scale was suggested internally as a feature just before we shipped the sample, but I was unable to include it because we were right at the end of development.

The outlines are generated in UV space, so currently they’re relative to the scale of the element that they’re assigned to. Making the thickness constant would require making them relative to screen space instead. It’s not impossible to do, but would take a bit of re-thinking and changing around the way it’s implemented.

Can you be more specific about the problem you’re seeing with RectTransform? It was working as we intended when we shipped the sample set. Although making it behave correctly in scene view, game view, when running the project, and in a build was a challenge.

Thanks for the reply!
I was able to achieve consistent outline thickness and corner roundness by dividing those values by the smallest side size.


It’s an easy fix but not the obvious one.

For the bug - it is very difficult to set the size of objects with the RectTransformSize component using text input. When I start typing, the text field loses focus after pressing just one key. On the video I’m trying to type 100, but editor is losing focus of the text field.

Also another bug - I can’t change properties of the material in the inspector of selected object in scene. I can do it only if I select material in project window.


Also visual changes of the materials are applied only after scene save and not immediately.

Can you share full Shader Graph?