0
\$\begingroup\$

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

\$\endgroup\$
0
\$\begingroup\$

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);
\$\endgroup\$
  • \$\begingroup\$ Remember to mark the question as accepted if you solved your problem \$\endgroup\$ – user100681 Dec 2 '17 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.