- Home /
The question is answered, right answer was accepted
Why is my code duplicating the name of a button? styling gui
I have tried to customise my buttons in unity, but for some reason the name of the button is duplicated in the corner of the button, and cannot be customised/deleted. How do I get rid of the duplicate? Screenshot
public GUIStyle style; public Texture Load; public Texture backGroundTexture;
void OnGUI() {
GUI.skin.button = style;
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), backGroundTexture, ScaleMode.ScaleToFit);
//GUI.DrawTexture (new Rect (0, 0, 200, 73), Load, ScaleMode.ScaleToFit);
if (GUI.Button (new Rect (Screen.width / 2.5f,Screen.height / 5 ,200,73), "Load")) {
Application.LoadLevel(1);
}
if (GUI.Button (new Rect (Screen.width / 2.5f, Screen.height / 3, Screen.width / 5, Screen.height/10), "Exit Game")) {
Application.Quit();
}
}
Answer by hav_ngs_ru · Nov 05, 2014 at 02:20 PM
Are you sure that you dont have any other gameobjects in scene with the same OnGUI? Or maybe you have duplicated script on the same object? I guess your problem is out this code.
yes thank you that was the problem! i don't know when i added it to the other object and that was causing the issue
Follow this Question
Related Questions
GUI Button to replace a click on a waypoint in 2D pathfinding 0 Answers
How can you do a custom GUIStyle image position? 1 Answer
Changing the font size of a GUI.Button in the inspector 1 Answer
Is it possible to detect which GUIStyleState is used? 2 Answers
Problems with GUI relative coordinates once the game is published for web view 1 Answer