how to create a border around 2d text?
I was looking into how to make a white rectangular border around a text item that has mouse focus, but it doesn't seem very straightforward.
Currently I'm using a textmesh to display Text, but i am not sure if i have to use it particularly.
I'm not really sure whether there are any huge advantages/disadvantages to using textmesh vs manually using UI.label or something in the OnGUI function, but in any case, what I'm trying to do is put a highlight border around the textbox. Is there any built-in component for doing this, or do I need to manually draw lines/ a rectangle behind my text box of the right size?
Answer by mondovila · Sep 21, 2017 at 04:22 PM
seems that Outline outlines letters and not the frame.
Answer by parsanope · Nov 02, 2019 at 07:24 PM
Just for the beginners, Click on the element that you want to add border (outline) to, in the inspector, scroll down and click on the add component button, search for "outline" and you'll see the outline component appears, select it and now you can set it's horizontal and vertical thickness by changing the x and y values. remember, adding the outline to a text element will actually add a border to the letters not to the whole Text element, if you want a border around your Text element, wrap it in an Image element and set their size equally, and add the outline component to the Image element. I hope it helped.
i know its been a long time since you answered but i was wondering if there is a way to change the size of the outline since its way too small the way it is now
Answer by fluxhackspro · Aug 30, 2017 at 07:52 AM
There is a 'outline' component that you can put on your unity 5 UI text objects.
Your answer
Follow this Question
Related Questions
Fix TextMesh Pro UI outline shader artifacts 4 Answers
Line wrapping in string array elements (using \n) 0 Answers
Textmeshpro: setting text to string.empty does not return an empty string 2 Answers
Simple scaling of TMP object based on device resolution 0 Answers
How to fix blurry Text Mesh Pro UGUI ? 0 Answers