I am working with some right aligned input fields, but when I type in spaces the text doesn’t move until I add a visible character. Is there a way to fix this? Interestingly, tabs work, as do spaces after a tab.
This current behavior is by design and mirrors other text tools like Microsoft Word, Google Docs, etc. where spaces at the end of a line do not affect alignment. The non-breaking space \u00A0 and the Tab character does affect alignment.
Spaces after a Tab should not affect alignment so in theory that is a bug.
Can you provide more insight on your use case for spaces affecting alignment?
I have input fields where the text is aligned to the right. It just feels wrong when adding spaces don’t move the text. I understand that this doesn’t make much sense for static text that is aligned to the right, but when the user can input text during runtime, there needs to be feedback that the text has been received.
I recently switched one of our projects from using the ‘old’ Unity UI Text, where this worked as I expected it to.
Regarding the tabs, I didn’t try it in runtime, I just selected the TextMeshProUGUI Object and added a tab to the text via the inspector. The text was aligned to the right and the tab moved it to the left. Adding more spaces afterwards moved the text, too.