It all says in the title of the question^^^
TextBounds is a Vector2 value corresponding to the size on screen in pixels that text takes up.
As far as I know, it will only populate correctly / immediately for LocalScripts (a comment for someone who knows better would be good), and for objects which have their Parent
set.
As a Vector2, it is very similar to a Vector3, except that it only has a .x
and .y
component and not .z
. It still has a .unit
and .magnitude
but for the purposes of text layout those will be meaningless.
TextBounds can be used to fit multiple elements of text (usually of different styles) together while still obeying the natural spacing of the font by computing where the position of further text should be after computing the position and size of other text.