Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add text outline in unity

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.

like image 759
PetqImaQkaputka Avatar asked Jun 30 '16 14:06

PetqImaQkaputka


People also ask

What is Textmeshpro?

TextMesh Pro is an easy-to-use system for high-quality text. It has many text appearance and formatting options, and is an easy way to add a professional touch to any project's user interface.


2 Answers

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.

like image 74
Uri Popov Avatar answered Nov 20 '22 17:11

Uri Popov


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

like image 38
Fattie Avatar answered Nov 20 '22 17:11

Fattie