Hello,
I want to set the TextAlignementOptions for TextMeshPro in my inspector and assign it during runtime.
However I get a nullreference when I test it and the Alignemnt always defaults to kind of centered but not really.
public TMP_Text text;
public TextAlignmentOptions options = TextAlignmentOptions.Baseline;
// Start is called before the first frame update
void Start()
{
text.alignment = options;
}
I’ve debugged the code and options is always zero (0). This shouldn’t be possible since the enum starts with TopLeft (257), so I’m stumped right now.
If I assign the options in code like text.alignment = TextAlignmentOptions.TopLeft; it works, however I want to set it via inspector so this is not a solution.
I am using Unity 2020.3.2f1 and TextMeshPro 3.0.6.