I am having some issues when creating UI elements dynamically and the font size showing up incorrectly. The button is a prefab and font size set to 42 pixels. The elements next to it are not created dynamically and are set to the same font size and all settings are the same. It also is smaller or larger depending on the screen size but is NOT set to best fitenter image description here

Using Unity 2017.x


1 Answer 1


Looks like there was an issue in my prefab instantiation. Not sure exactly what it is but this fixed it:

GameObject TechList = Instantiate (Prefab) as GameObject;

TechList.GetComponent<ButtonTextController> ().ChangeText (SkillInfo.SkillName); // Only changes button text

TechList.transform.SetParent (this.transform, false);

TechList.transform.localScale = new Vector3(1, 1, 1);
  • \$\begingroup\$ Remember to mark the question as accepted if you solved your problem \$\endgroup\$
    – user100681
    Dec 2, 2017 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .