Skip to content

Instantly share code, notes, and snippets.

@mabako
Created March 21, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mabako/6be62805f95eb87de89a to your computer and use it in GitHub Desktop.
Save mabako/6be62805f95eb87de89a to your computer and use it in GitHub Desktop.
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