Unity TextMeshPro solves Chinese garbled characters and modifies the default font

(Self-study unity problem generation and solution record stickers)

Environment and version: windows, unity 2021.3.20f1c1

1. Create TextMeshPro to input Chinese and produce garbled characters

Problem: TextMeshPro Chinese display garbled characters

Solution:

Use the system's own fonts

Find a font in the C:\Windows\Fonts path, take Microsoft Yahei as an example, copy it to the unity directory (in the unity project, right click on the project > Show in Expolrer), create a folder, take Asssets\Font as an example .

After copying, you can see the following three files

Right-click MSYHBD>creat>TextMeshPro>Font Asset to generate the following files

Drag into the TextMeshPro component

The modification is successful and the problem is solved

2. Modify the default font of TextMeshPro

Problem: After successfully solving the problem of garbled characters, the font needs to be modified every time a new TextMeshPro component is created, and the blood pressure soars. Modify the settings once and for all.

Solution: Edit>Project Settings at the top of the project

After opening TextMesh Pro>Setting, modify the Default Font Asset

Create new TextMeshPro

The default is Microsoft Yahei, there is no garbled characters when inputting Chinese, and the problem is solved

Guess you like

Origin blog.csdn.net/Tyc13913514468/article/details/129678780