- Home /
GUI Label does not show sometimes
I have simple GUILabel in OnGUI(). It works at the beginning. But after a period of time, It does not show up when I run the editor. And when I pause the editor, i can see the GUI again, and I am able to see it after I unpause the editor. What's the problem?
The code is simple:
void OnGUI() {
GUIUtility.ScaleAroundPivot(new Vector2(Screen.Width/768f, Screen.height/1024f), Vector2.zero);
Rect rect = new Rect(635, 990, 100, 50);
GUI.Label(rect, "Ver.", verStyle);
}
I think we will need some code to even begin to help you.
I think you should go through the docs. The example will help you. And the problem might be of screen resolution. Your lable might be going out of resolution or it was scaled too low that it can not be recognized. And what final result you want is important.
Thanks for the comment but how can you explain when I pause and unpause the editor, GUI reappears
Try to scale and position the label with variables. And put a log for that variables to check the scale and position at runtime.
By the way I have tested whether the scaling affects or not. I commented the ScaleAroundPivot and use 0, 0 as the coordinates, result is the same.
Your answer
Follow this Question
Related Questions
JS changing gui box color 1 Answer
Rotating a Rect by the GUI.matrix? 0 Answers
How to position elements on scene 0 Answers
How to GUI texture image change? 1 Answer
Make GUI elements disappear 3 Answers