7

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.

Fattie
  • 27,874
  • 70
  • 431
  • 719
PetqImaQkaputka
  • 147
  • 1
  • 1
  • 7

3 Answers3

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.

Uri Popov
  • 2,127
  • 2
  • 25
  • 43
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

Fattie
  • 27,874
  • 70
  • 431
  • 719
  • 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. – Programmer Jun 30 '16 at 14:50
0

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.

J0ANMM
  • 7,849
  • 10
  • 56
  • 90