- Home /
Making a border on a LineRenderer
Hi, I am trying to make a LineRenderer have a border to make it stand out from the background. To do this, I created an image but the border stretches making it not have the same width on each side of the line. This is the image
And this is the result when used on the LineRenderer
I have tried to use borders in the sprite editor section to stop stretching the image but it does nothing, probably because it is a texture. Is there a way to only make the white area stretch, or would the best option be to have multiple LineRenders, one white and the other black, where the black is slightly bigger and located behind the white one?
As far as know, you are correct about the "9-slice" thing. Setting no-stretch border areas is only for specific components, and lineRenderers don't have it (they would rarely want it.)
$$anonymous$$aking a black "underlay" could work, but takes some math to get the sizes right, and to avoid flickers.
I've done this by code-creating a custom mesh, but if you don't already know how to do that, it's a ton of work learning.
Best workaround is probably to only use "long" left-right borders. And hand-add front/back borders if really needed (a little cube or something.)
Thanks for the reply, i managed to do the underlay and it gives the effect that i wanted it to. The flicker was not an issue as its a 2d game, meaning that it does not have to be on the same z coordinates.
Your answer
Follow this Question
Related Questions
Clam Neck Stretch Not Satisfying Enough 0 Answers
Line Renderer How to move individual keys 0 Answers
LineRenderer End Width Bug 2 Answers
Laser LineRenderer Tapers after first Reflect 0 Answers
What is the best way to draw a border around a viewport? 1 Answer