I’m having a weird issue with the TMP InputField. If I change the text via script, e.g.:
nameField.text = "New Solution";
Then the text gets shifted left a bit:
As soon as I click the input field it seems to recalculate the position and the positioning gets fixed. Is there some method I need to call to force this recalculation?
Just tested on my end and it appears to be working fine.
See if you get the same results creating a new TMP_InputField without modifying any of the positions / offsets of the child objects. Perhaps in your example, you modified these values which results in the incorrect positioning?
Okay yeah it doesn’t happen with a fresh TMP_InputField, but once I change the anchors of the input field itself (not the children) the problem shows up. In particular, I’m using MinX = 0, MaxX = MinY = MaxY = 1.
That said, I haven’t been able to reproduce it in an empty project yet, so I’ll keep fiddling around.
(In the empty project I noticed another issue though: the Text child of the InputField was using the default TMP font settings, which made it way too big for the input field. This only happened on the first input field though, which triggered the import of TMP Essentials.)
I have noticed weirdness when creating / using a TMP object that was created prior to importing the TMP Essential Resources. When I have time, I need to track this down.
For the time being make sure you import the TMP Essential Resources before hand.