How to center the text's value or words

So my case is that I want the text to align in the center…
For example: in this image

The number “1” is in the center… let’s say that’s the coin of the player…
So if somehow the coin adds like plus 1000 (for example the player receive a reward or something that adds his coin)
This happens in the preview:

So I want it to be like this in the preview:

Like it goes to the center automatically when the value of the number somehow adds
or subtracts…

PS Sorry I am bad at explaining things and Engish… Thanks!

To centre a text, you need to change the position of the Text object. To get the width of your scene, we use SceneWindowWidth(). So we will change the X position of our Text object set to SceneWindowWidth()/2-TextObject.Width()/2.


What we did here is, we got the centre of our screen by dividing the SceneWindowWidth() by 2 and placed the centre of our TextObject (which we got using TextObject.Width()/2) there.

It can be a little simpler. After filling the object with text, you can set the position of the middle of the object:

1 Like

We also gotta reduce (minus -) the SceneWindowWidth() by Object.Width()/2 (SceneWindowWidth() - Object.Width()/2) to get perfectly in the middle.

1 Like

@Muzan If you can set the coordinates to the middle of the object, how does this differ from your method? I am clarifying in order to understand (and know in the future), perhaps there are some subtleties in this moment.

1 Like