I have this code, overhere… but when I press on the button it suposse to say on the screen Blocked. Play Mission to unblock. But when I do it, there´s nothing coming up. What is wrong? (I have the GUIStyle as normal, Arial, 20, Black)
Ok. I got that; It was because of the GUITexture that I have not setted up… so, now, the Debug.Log(“hello”); is working, but the GUILabel still not showing up
GUI.Label(new Rect(0, 0, 100, 100), "BLOCKED. PLAY MISSION TO UNBLOCK");
And if that works then go step by step: change coordinates, add style till you find out where it goes wrong.
In your code the label height might be a negative value from what I can see.
Log the “Screen.width * .25f” and the rest of the rect values and see if they are what you expect.
This is so sad, hehehe… I did. I tried 0, 0, 100, 100 and I also logged “Screen.width * .25f”… results still the same. first one did not appear and second one is 186.50 in a 5:4 resolution.
Is it because of the conditional? I mean… it never happened before, but maybe a GUILabel cant be inside a conditional… there´s nothing else I can think of…
Maybe the 2 things cant work together…I mean the button and the Label… because if I try the Label before I place any buttons, it is there, but, it does not work when I want it to appear after pressing the button
Cannot put the label inside that button if condition,
make a bool value, set it to true when button is clicked,
then (outside that button code) check if that bool is true, show label there
Right. So the problem is that the button condition will be triggered once after the button was clicked and so the label gets rendered but only once - on a single frame.
Like mgear said you need to set a flag that will persist beyond that frame and set it’s value upon button click.