How to add text outline in unity
Asked Answered
T

4

8

How can i add text outline in unity over a text UI object?

I want to do it in the designer/editor view. i cant see to find any useful topic and i also cant see how to add it from the designer view.

enter image description here

My project is 2d and i'm using the latest unity version 5.3. I want to achieve similar effect.

Touchmenot answered 30/6, 2016 at 14:28 Comment(5)
This is an excellent question. Whoever voted to close it is very silly.Salvador
This is too broad. Please start by reading How to Ask and some Unity tutorials.Estellaestelle
@JoeBlow I'll remove the downvote as soon as I see some research effort or things tried.Estellaestelle
Well I'm trying to add it from the designer view what else can i research ? I can only tell you what i see in there and there is no option to add text outline..Touchmenot
hi @Touchmenot I have put in a full answer. Enjoy!Salvador
S
3

Note! This explains how to make custom type ("sprite sheet type") in Unity.

Before reading it, check Uri's & Programmer's answer which explains using the handy new "outline" feature in .UI ! It may well be enough!


Unity does not have any fancy type handling at all.

You can drop in "normal" .ttf fonts,

or, you can drop in "image fonts", called custom fonts by Unity, where you literally make each letter on a sprite sheet.

A font sprite sheet looks something like this:

enter image description here

Here's exactly how to do it ...

(1) you have to use GlyphDesigner (or any similar product) to actually make your custom font sheet. Find the product you like for your Mac or PC to do this.

(2) There is a critical trick.

Unity completely forgot to include a type matcher for custom fonts. (They may fix this in Unity 6.) It's one of the stupidest things in Unity. So, fortunately there is a free and perfect script

BitmapFontImporter.cs

https://github.com/BenoitFreslon/BitmapFontImporter

There's a full and long tutorial link at that page.

You have to include that to make custom fonts work. It's just one of those weird things about Unity.

So in short, firstly you have to literally "draw" such custom fonts, letter by letter. In fact you need to use something like GlyphDesigner to do that.

Secondly in Unity you have to use the extremely handy script mentioned above or it won't work. Enjoy!

http://answers.unity3d.com/answers/1105527/view.html

Salvador answered 30/6, 2016 at 14:36 Comment(1)
I think it is a great answer. I added the outilne solution in your answer to cover another possible way with Unity's built in effect.Kearse
S
12

Or. Alternatively to Joe's answer. To simply add a outline effect to a normal .ttf font :

  1. Click on the text object from the Hierarchy
  2. Click the Add Component button in the inspector

  3. Type "outline" in the search bar.

  4. Add the outline component.

Stoned answered 30/6, 2016 at 14:46 Comment(1)
This seems to only allow for pixel thin outlines?Gowrie
S
3

Note! This explains how to make custom type ("sprite sheet type") in Unity.

Before reading it, check Uri's & Programmer's answer which explains using the handy new "outline" feature in .UI ! It may well be enough!


Unity does not have any fancy type handling at all.

You can drop in "normal" .ttf fonts,

or, you can drop in "image fonts", called custom fonts by Unity, where you literally make each letter on a sprite sheet.

A font sprite sheet looks something like this:

enter image description here

Here's exactly how to do it ...

(1) you have to use GlyphDesigner (or any similar product) to actually make your custom font sheet. Find the product you like for your Mac or PC to do this.

(2) There is a critical trick.

Unity completely forgot to include a type matcher for custom fonts. (They may fix this in Unity 6.) It's one of the stupidest things in Unity. So, fortunately there is a free and perfect script

BitmapFontImporter.cs

https://github.com/BenoitFreslon/BitmapFontImporter

There's a full and long tutorial link at that page.

You have to include that to make custom fonts work. It's just one of those weird things about Unity.

So in short, firstly you have to literally "draw" such custom fonts, letter by letter. In fact you need to use something like GlyphDesigner to do that.

Secondly in Unity you have to use the extremely handy script mentioned above or it won't work. Enjoy!

http://answers.unity3d.com/answers/1105527/view.html

Salvador answered 30/6, 2016 at 14:36 Comment(1)
I think it is a great answer. I added the outilne solution in your answer to cover another possible way with Unity's built in effect.Kearse
I
1

Another option that worked easier for me is:

  • In Project, select the font asset you are using
  • In Inspector, under "Atlas & Materials" select the Font Material
  • In Project, select the Font Material
  • In Inspector, under "Outline" raise the "Thickness" to the desired level
Isolecithal answered 29/7, 2024 at 23:18 Comment(0)
C
-2

TextMesh Pro from the Asset Store does the job and it can be imported for free.

This gives plenty of possibilities fort texts, including how thick the outline should be.

Climb answered 29/11, 2018 at 9:19 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.