When using the cachedTextGenerator from a Text field to calculate the necessary height for a certain text, I get a height value for 2 lines of text, even though the final Text UI on screen fits the text in one line.
I checked the with of the text field in the editor and it is exactly the same as used for the generator.
Am I doing something wrong besides doing the following steps?
- get the cachedGenerator
- get the Settings from the Text UI with GetGenerationSettings
- calling GetPreferredHeight on the generator with the with I just mentioned and with the grabbed settings
It might be worth mentioning that I generate the settings with a Vector2 with the correct width, but with 0 height, since I don’t need it.
Any ideas?