Auto typing text and its width

Hello

I’m trying to center texts with ‘auto typing’ behavior
using the texts’ width and height.

But it seems like auto typing texts’ widths and heights are constantly changing while typing.

So the width starts with 0 and ends with the full width of the text.

If I do something like this, (positioning ‘text’ at the center of ‘box’)

(Trigger once)
Create ‘text’ at position of
X position: box.X() + (( box.Width() - text.Width() ) / 2 )
Y position: box.Y() + (( box.Height() - text.Height() ) / 2 )

it does not work as I intended because width and height are 0 at the beginning of auto typing.

If I get rid of ‘trigger once’ and put the text at the center every frame, it moves wierdly because the width and height are keep changing.

Is there any solution for this??

Thank you!!

You could try using an invisible placeholder object positioned at the center of the box. Then, update the position of the text object based on the placeholder’s position using an event that runs every frame. I think that’ll keep the text centered even as it changes size. If you dont want it to change size I think you could set the fixed size in the text object properties.

How do I set the fixed size in the text object properties?! Do you mean custom sizes?!

Thank you for the reply!! :blush: