I am new to BJS (and for that matter the whole topic of rendering) and while toiling the docs I noticed that re-setting the text on a TextBlock that has already been added to an AdvancedDynamicTexture changes the text’s vertical position upwards.
Here is the docs example I am modifying, and here is a working (broken) example:
changing the text while the TextBlock is attached breaks vertical position
removeControling and re-addControling the TextBlock breaks vertical position
removeControling the TextBlock and creating a new one works fine
Not part of the playground, but tested: The position change only happens for TextBlocks that had previously been addControled to the AdvancedDynamicTexture, creating a TextBlock and wildly changing the text on it before addControling it makes no difference.
Am I missing something obvious or is recreating TextBlocks all the time the standard method of updating text or is this a bug?
I was a little confused when changing the text back to it’s original did not revert the positional change. Is that expected? I had expected the TextBlock width and height to be persisted (without enabling resize to fit) and thus identical text to be positioned identically as well, but I guess that is not how it works
The textblock’s width/height is dynamically adjusted based on the text it contains so it is expected that changing the text would modify the height however I agree it is unexpected that reverting to previous text does not revert to previous height. This may be a bug, I will investigate!