- Home /
GUI Question
I have written a code for gui but what happens is when playing it in the editor it works perfectly but when I build the game and run it the gui overlaps after pressing button I have used code like this:
void OnGUI() {
if(CreatingNew == false && Loading == false && ClassSelection == false && HostingSelection == false) { //Creating A New Character
if(GUI.Button(new Rect(Screen.width/2-Screen.width/10, Screen.height/2 - 30, Screen.width/5, 20), "Create New")) {
CreatingNew = true;
}
to disable GUI after the button has been clicked and it disables in the editor but not in the build.
thank you for any help
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613104541im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do you save the Audio Mixer once changed? 0 Answers
How to exclude "Selection & Handles" and other editor-specific code in builds? 2 Answers
GUI error when using HandleUtility.PickGameObject() 1 Answer
Editor GUI error 0 Answers
OnGUI() works in editor, but not in build with an odd twist! 2 Answers