text.preferredHeight bug?

Hi, I’m having issue with Text’s preferredHeight giving the wrong result when I mouse over the button for the first time. It corrects itself when I move away and mouse over again.

I’ve tried a few different fonts with the same result, so it’s not a font problem. Anyone having similar issue?

I’ve extracted the menu from my project into a stand alone scene to show the issue. Attached is a screenshot and the Project file if anyone wants to give it a test. Thanks

To recreate the issue:

  1. mouse over any of the buttons
  2. move away and mouse over the button again
    You’ll notice that the text box is longer on the first mouse over

1753900–110940–TextBox test.zip (149 KB)

Hi. If you believe you’ve found a bug, please file a bug report with the project attached and a description of how to reproduce the problem.

Thanks. Reported (Case 629734)

I was having this problem too. For some reason the text box needs to be larger than the text to properly calculate the preferred height. As a temporary fix, you can make the initial size of the text box much larger than it will ever need to be.

1 Like

Thanks, that does help!
However because my project have text of various length, the bug still pops up whenever I mouse over a shorter text before going over to a longer one. Perhaps I could temporary hack it to reset to a larger text box before attempting to calculate the preferred height again.

Making the text box size larger right before finding the preferredHeight should fix the problem, but it’s kinda dumb that it’s even necessary to do. Hopefully this bug gets fixed.

1 Like