Article directory
foreword
In order to become "the main program of Unity in the future", learn the realization of various basic functions, deeply understand and understand performance optimization methods, etc., this series is a series of realizing a certain function and a certain logical operation, so that each little knowledge becomes The nourishment of our evolution.
提示:以下是本篇文章正文内容,下面案例可供参考
1. What is a bitmap?
This article is mainly to share how to make Bitmap fonts (picture fonts) in Unity. I assume that people who read this article already know what making Bitmap fonts is. Many times you encounter problems and no one can help you. You are only on your own. If you don't know what making Bitmap fonts is, please Google it first (resist Baidu from me).
2. Use steps
1. Art resources
This resource varies from person to person, I use the most commonly used digital UI art resources here
2. Use the slice tool or other tools with the same effect to process the picture
Here I use the slice tool of PS. It is also the first time for me to use the drawing. The drawing is not very regular. Try to make each picture the same size, otherwise the subsequent rendering effect will be a bit abstract. (Go to Google if you don’t know the slicing tool!)
After processing, export the format used by the Web
to select the folder you exported, and PS will automatically export it, as shown in the figure
In this way, the picture resources have been made, of course, if there are ready-made ones, use the ready-made ones, and make them for the artists if they can do it ()
3. Download and use Bitmap Font Generator
1. Program download
Bitmap Font Generator: download address
2. Program use
After running bmfont64.exe
and starting, click the option in the upper left corner Edit/Open Image Manager
. In the pop-up window, click Image/Import image..
to import the picture
Select 0
the picture of the number and Id
enter 0
the corresponding ASCII code in the input box: 48
click OK
the button to import
Import all the digital pictures exported by PS.
The imported pictures will display sky blue square dots
The ASCLL coding comparison table is at the end of the article
3. Configuration settings
Click the menu Options/Export options
in the upper left corner and set the width and height ( ) of the final exported image in the pop-up window Wideth、Height
. This size depends on the art resources. In normal use, it is set to be an image after export, and the numbers on the image are all the numbers set before; set the font
description The file format is XML
;
set the font image format to png
;
finally clickok
4. Export
click menuOptions/Save bitmap font as...
Select the export path in the pop-up page.
After export, two files will be generated: .fnt
and .png
, as follows. The files
如果发现生成了多张PNG图片 请重新设置图片宽高
here .fnt
record the coordinate parameters of each number in the picture.
4. Use the exported custom fonts in Unity
Download the BitmapFontImporter plugin
In this way, you can directly drag in and use
the BitmapFontImporter plug-in
After Unity is installed, drag the exported two files into it and you can use it
5. ASCLL code comparison table
6. Summary
The bitmap is basically provided by the art side, but we also have to know it~
Bitmap Font Generator can also be imported into Chinese, if you are interested, you can Google Kangkang~