GUI Labels doesn't center anymore
Hello there.
So I've put on "void OnGUI()" function this code:
var centeredStyle = GUI.skin.GetStyle("Label");
centeredStyle.alignment = TextAnchor.UpperCenter;
To make health (100/100) I've put this code:
h1 = gs1.health.ToString() + "/100";
GUI.Label(new Rect(Screen.width / 32 + Screen.width / 32 / 2, Screen.height - Screen.height / 4 + Screen.height / 4 / 6 * 4, Screen.width / 32 * 2, Screen.height / 4 / 6), h1, centeredStyle);
It was working for a while: the labels were centered as it shown where they should center on arrows. But today they refused to center. They align to the left corner. I tried to update my Unity but that didn't help. Thanks in advance for the help!
1.png
(290.0 kB)
Comment
The coordinates are O$$anonymous$$. You see, everything was allright until today. It just stopped to center.
Your answer
Follow this Question
Related Questions
Auto resize/rescale ongui 0 Answers
Duplicate GUI.Label Instances 1 Answer
Dont round decimal places? 2 Answers
Assigning a variable to my label 1 Answer
OnGUI() problems in unity 5.6, worked with Unity 4. 0 Answers