I am using Unity 2020.3.2f1 and TextMeshPro 3.0.6.
I want to expose the TMPro TextAlignmentOptions to the inspector and assign it via code during runtime.
e.g.:
public TMP_Text tmpText;
public TextAlignmentOptions myAlignement;
private void Start()
{
tmpText.alignement = myAlignement;
}
The problem is that during runtime the text is always centered. I’ve debugged the code and noticed that the value of myAlignement is always 0. I know that enums can be converted to ints however the value of myAlignement always remains 0 no matter what I change, looking at the enum, its lowest int value is 257, so I can’t even cast it back into TextAlignmentOptions if I wanted to.
I’ve already checked if it’s a general problem with Alignements in my TMPro version, if I assign the alignment ‘hard’ in code like tmpText.alignement = TextAlignmentOptions.TopLeft; everything works. But since I want to be able to set the alignement in the inspector this isn’t an option.
I already googled the problem but only found responses regarding how to convert HorizontalAlignmentOptions and VerticalAlignmentOptions to TextAlignmentOptions.