Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private UILabel CreateLabel(string type, Vector2 location, string text)
{
var lblObject = new GameObject("NameOfTheMod/" + type, typeof(UILabel));
lblObject.transform.parent = panel.transform;
var label = lblObject.GetComponent<UILabel>();
label.absolutePosition = location;
label.textAlignment = UIHorizontalAlignment.Center;
label.verticalAlignment = UIVerticalAlignment.Middle;
label.width = labelWidth;
label.height = 30;
label.text = text;
label.textScale = 1.1f;
label.textColor = new Color32(255, 255, 255, 255);
return label;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment