Hi
I’m using
function OnGUI() {
if (showBox) {
GUI.DrawTexture(Rect(posX, 50, 500, 600), information);
//print(“created one button!”);
if(GUI.Button(Rect(600 , 610, 80, 30), “close”)) {
showBox = false;
}
}
}
(How do display this as code?)
The button is opaque, which I think indicates, that it gets created more than twice and lying on top of the others.
If I use a variable (posX + 500) for the Buttons xPosition, the button gets created at 2 places. Also the “second” created button is opaque, which I think indicates, that it gets created more than twice and lying on top of the others.
This does not happen to the GUI.draw.
Any Ideas?
I should mention that this script is on several objects which contain the information = Texture2d, depending on the object. If that is interfering, is there an easy way around this?
Also just for my understanding, the GUI objects are not actually objects, but get recreated each frame showBox is true?