Город МОСКОВСКИЙ
00:01:25

How to import fonts TTF in Unity

Аватар
Как Сделать Креативно
Просмотры:
57
Дата загрузки:
11.09.2023 18:32
Длительность:
00:01:25
Категория:
Видеоигры

Описание

For more tutorials: http://www.bitdotcom.com/blog/

In this video I'll show you how to import fonts (TTF) in Unity and how to write a text on the GUI.
C# script:

using UnityEngine;
using System.Collections;

public class DrawGUI : MonoBehaviour {

void OnGUI() {
GUIStyle style = new GUIStyle ();
style.font = (Font)Resources.Load("my_font", typeof(Font)); // The font file must be in the "Resources" folder!
style.fontSize = 50;
style.normal.textColor = Color.red;
GUI.Label(new Rect(10, 10, 100, 20), "Alien Attack!!!", style);
}

}

Рекомендуемые видео