Unity3d uses fairygui to customize font operation

Time:2022-5-4

Recently, UI students used a new font (sharp characters, sharp lines, black Jane in full bloom) and found that all the fonts were cut into pictures, which scared me to death

Process of using fonts with unity3d and fairygui

1. The first step must be to find art students to get the fonts they find

Since the font used by the fairygui editor is the font accessing the operating system, double-click the new font to install it (or put it into the windows / fonts in the operating system disk) as shown in the following figure

图1

2. Add a text in fairygui and select the font to find the font we added

3. Then copy the font to the unity3d project

Store it in resource \ font (there is no folder you can create yourself). Note that the name here should not be changed at will

4. Support multiple dynamic fonts separated by commas

And inject the font. Pay attention to the naming here

That’s the end of the tutorial~

Supplement: about fairygui’s bitmap font display error in unity

The bitmap font created in fairygui is displayed normally in the editor, but it is sometimes found that the display is disordered in unity. After comparison, it is found that the display is disordered because there are too many pictures in the package.

The bitmap font is also packaged into an atlas and imported into unity. We assume that the bitmap font is 0-9. When there are many pictures or the pictures are large, the atlas is divided into two parts. At this time, 0-4 in the bitmap may be in atlas 1 and 5-9 in atlas 2. In this way, the display of 0-4 is normal and the display of 5-9 is disordered (it is speculated that the position of 5-9 coordinate in atlas 1 is displayed).

Solution:

1: Disassemble the package body, disassemble the package into several small packages, and try to ensure that there is only one atlas in one package.

2: A separate package is designed for bitmap fonts to ensure that there is only one atlas, which is preloaded in the way of addpackage.

The above is my personal experience. I hope I can give you a reference, and I hope you can support developpaer. If there are mistakes or not fully considered, please don’t hesitate to comment.

Recommended Today

Implementation example of adding permissions with laravel and Vue

catalogue 1、 Add (permission) node 1.1 introduction of Vue 1.2. Add templates (Vue, jQuery) 1.3. Add node controller logic 1.4. Define modifiers in the model 1.5. Effect: 1、 Add (permission) node 1.1 introduction of Vue usevueManage the interface and realize the addition functionWe put it in this directoryvue.js: 1.2. Add templates (Vue, jQuery) resources/admin/node/create.blade.php: <!–_ […]