跳至主要内容

Scripting

Code Snippets

The namespace
using ChocDino.HQText;
Add the HQText component to your GameObject
// Add the component to your GameObject and set default properties
AddComponent<HQTextUGUI>();
var hqtext = GetComponent<HQTextCoreComponent>();

var props = hqtext.GetCore().Properties;
props.UseMarkup = false;
props.FontSize = 25;
props.Font = "OpenSans";
props.FontFace = "Regular";
props.TextColor = Color.black;
props.HorizontalAlignment = HorizontalAlignment.Left;
props.VerticalAlignment = VerticalAlignment.Top;
props.HorizontalWrapping = HorizontalWrapping.Wrap;
props.VerticalWrapping = VerticalWrapping.Clip;
props.LineSpacingInPixels = 0f;
props.AutoPadding = true;
props.Padding
props.Justify = false;
props.AutoDirection = true;
props.Direction = Direction.LTR;
props.TextBoxWidth = 100;
props.TextBoxHeight = 100;

hqtext.SetText("Hello World");
Typewriter Effect
var hqtext = GetComponent<HQTextUGUI>();
hqtext.RevealLetters = (Time.time * 0.2f) % 1f;