- Home /
Question by
fireapache · Feb 02, 2011 at 07:29 AM ·
textcenterrelativegui-style
How do i centralize one string in any viewport size?
Hi, I want to create the subtitle system to my game, but i don't know how centralize the text on the screen!
Comment
Best Answer
Answer by DaveA · Feb 02, 2011 at 07:55 AM
Use a GUIStyle: http://unity3d.com/support/documentation/ScriptReference/GUIStyle.html Set to center, much like html
Another way, what I did, was make an empty game object, call it 'captions' or something. Add a GUIText component, set its attributes to Anchor middle center and Alignment center. Attach your script to same object.
Your answer
![](https://koobas.hobune.stream/wayback/20220613102413im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Make UI always center the panel 1 Answer
How to display a "Game Over" after death? 2 Answers
Strange badges background text, and long Accept button text. 0 Answers
New to Unity - Information Dialog 1 Answer
My GUI text dissapears... 2 Answers