Hi, me again, I can’t make a Gui work, here’s my script, I’ve tried with both “OnGUI” and “OnGui” and I can’t get it work. Am I doing something wrong??!!
I started a new project, and attached my c# script to my camera, it didn’t work, I tried with empty objects and nothing, I also tried with Button, Text , and also Nothing!!
public class Example : MonoBehaviour {
void OnGui ()
{
GUI.Label (new Rect (10, 10, 100, 20), "Hello World!");
}
}
public class Example : MonoBehaviour {
void OnGUI ()
{
GUI.Label (new Rect (10, 10, 100, 20), "Hello World!");
}
}
hi. is it too late?
i had same problem and figured out it’s because of lighting problem.
first off, check the window → lighting setting. then just the skybox set to None.
if you may see the gui, then solve just lighting problem.
Another reason that the OnGUI could appear to not be working is if you changed the Game’s Free Aspect Scale to a large enough value that the text is simply off the camera view. Yes, it can be that simple.