Ngui 3.5 tutorial (6) font

Source: Internet
Author: User

Fonts are an important part of the UI. Create a font with ngui 3.5 today.

The following is a demo of my shooting game. The ngui font is used to display the number of bullets. The effect is as follows:



Steps:

1,Search for (or make) fonts. The figure here is convenient. I directly use the font of the demo project in unity: xirod. TTF.

Under win7, double-click to preview. Display the font size.


2,Open the project, create a font directory under the assets directory, and copy the font file, that is, the TTF file.


3,Create an empty game body: gameobject --> Crete empty. To facilitate management, name the game weight font_xirod.


4,In the Inspector panel, add the ngui font script component to the empty game body. (Search for font)


5,Set the font component:

Set Font type to dynamic

TTF font is set to xirod


6,Drag font_xirod in hierarchy to the project to make the prefab (prefab) and then delete the game body.


7,If the UI root already exists, create a new label (ngui --> Create --> label) in the scenario ). If there is no UI root, you can create one.


8,Select the new label. In the Inspector panel, select font and select the new font.


9,Set the font size, and click "Snap.


10,Adjust the position. OK, the font is displayed normally!



Note:: Ngui prompt, dynamic font, cannot be made part of Atlas, use dynamic font will add draw call at least once.




Zookeeper

Ngui 3.5 tutorial (6) font

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.