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
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
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
It can be a little simpler. After filling the object with text, you can set the position of the middle of the object:
We also gotta reduce (minus -) the
Object.Width()/2) to get perfectly in the middle.
@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.