Does anybody has an idea why this is not working? Code (csharp): if (Input.GetMouseButtonUp(0)) { GUI.Label(Rect(100,100,300,33), String.Format("Test"), styleBox); } The GUILabel is not coming up when the mousebutton is pressed.
You havnt setup your button correctly and I would not try to do too much with your label at once until you have tested its basic layout first. Stay away from styles and text formating until its functional. and always run your gui inside OnGUI () declaration. this code is untested, for more reference check the docs. Code (csharp): if (GUI.Button(Rect (10,10,10,10), "click me")) { GUI.Label (Rect (10,10,10,10), "label text"); }
GetMouseButtonUp is only true for the frame the button is release. So your label probably does show up but only for one frame. What you probably want is to use a bool flag that is flipped when the user presses the mouse button.