You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesi贸n a prueba de IA

Antes: $249

Currency
$209
Suscr铆bete

Termina en:

0 D铆as
14 Hrs
46 Min
2 Seg

C贸mo crear texto en Unity

8/29
Resources

How to create text in Unity with Text Mesh Pro?

Text is a crucial component in the creation of interfaces in Unity. However, it has not always been so straightforward to use. Unity introduced Text Mesh Pro as the standard way to handle text, overcoming the limitations of its original option. In this content, we will explore how to implement text using Text Mesh Pro, a system that offers greater flexibility and visual quality compared to the 'Legacy' option.

What is Text Mesh Pro and why use it?

Text Mesh Pro is an advanced solution for rendering text in Unity. Initially developed as a standalone asset due to its superior capabilities, Unity adopted it as standard. Unlike the traditional method known as 'Legacy', Text Mesh Pro offers:

  • Improved Visual Quality: Renders text sharper and with better typography.
  • Flexibility and Styles: Allows advanced styles such as quotes, links, H1 titles, among others.
  • Dynamic Fonts and Sizes: Supports True Type fonts (TTF) and automatic sizes that adapt to the transformation rectangle.

How to create a text element in Unity?

To create a text element using Text Mesh Pro follow these steps:

  1. Create a Text Element:

    • In your Unity project, right click to open the creation menu, select UI and then Text - TextMeshPro.
    • A new object, called "New Text", will appear in your scene and a Gain Object in the hierarchy.
  2. Modify Text Properties:

    • Text: Change the contents of "New Text" to the message you want, for example, "Hello, world".
    • Styles: You can select styles such as bold, underline or a deadline. For now, leave it bold.
    • Size: Adjust manually or use the Auto Size option to make the text adapt to the size of the transformation rectangle.
  3. Set Advanced Options:

    • Auto Size Options: Controls the minimum and maximum text size and line size.
    • Color and Gradient: Change text color and experiment with gradient options for advanced effects.

How to import and use your own fonts?

Using custom fonts can enrich your designs. To import fonts into Unity, follow these steps:

  1. Create Folder for Fonts:

    • Inside your assets folder, create a new folder called fonts.
  2. Import Fonts Files:

    • Right click on the fonts folder, select Import New Asset and choose a font file type TTF.
  3. Create a Font Asset:

    • Right-click on the imported font, select Create > TextMeshPro > Font Asset.
    • This process will generate a new font asset with an 'F' icon.
  4. Apply the New Font in Text Mesh Pro:

    • Select your text and in the properties panel, assign the new font asset you have created. For example, "Kenny Blogs".

Text Mesh Pro properties in Unity?

When working with Text Mesh Pro, you can adjust several advanced properties that not only improve aesthetics but also functionality:

  • Spacing: Modify the distance between characters, words and lines.
  • Alignment: Adjust text horizontally (left, center, right, justified) and vertically (top, center, bottom).
  • Color and Gradients: Change text color and explore gradient options for custom visual effects.

Text Mesh Pro transforms the way text is managed in Unity, offering versatility and optimal quality. As you master these tools, you'll be able to create more attractive and functional interfaces. So keep exploring and experimenting to discover all that Unity and Text Mesh Pro have to offer. Don't forget to share your experiences in the comments to enrich the community - let's move forward together to the next level!

Contributions 0

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?