public static GameObject CreateButton(Resources resources)
{
GameObject parent = CreateUIElementRoot("Button", s_ThickElementSize);
GameObject child = new GameObject("Text");
child.AddComponent<RectTransform>();
SetParentAndAlign(child, parent);
Image image = parent.AddComponent<Image>();
image.sprite = resources.standard;
image.type = Image.Type.Sliced;
image.color = s_DefaultSelectableColor;
SetDefaultColorTransitionValues(parent.AddComponent<Button>());
Text lbl = child.AddComponent<Text>();
lbl.text = "Button";
lbl.alignment = TextAnchor.MiddleCenter;
SetDefaultTextValues(lbl);
RectTransform component = child.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
return parent;
}