I have a GameObject holding an Image and a Text. I now want to center the GameObject on the screen in realtime, since the text will be changing rapidly. I thought that I could read out the lengh of the text in pixels and based on that, I could center the GameObject by moving it. Btw, the Text has a custom font and FontSize. I found out that you could use CalcSize in GUIStyle, but I think that is some legacy stuff, is it? If yes, do you know a way to either read out the text lengh with a custom font and FontSize in pixels or a way to center the GameObject automaticly?
Thanks for your help.