- Home /
Trying to draw a GUI
I am try to draw a GUI in unity. It is there to do the same thing as GUI's do in RTS/building games - you click something like "build" and more options pop up. I can draw the static GUI without an issue, but when it comes to for instance, click "Build" and having a few labels like "Road" and "House" pop up, I cannot get that to run.
Basically, here is what it would be. This is all in C#.
void OnGUI() { if GUI.Button (new Rect (0,0,50,50), "Build") { Caller(Build); } }
void Caller(string Call) { if (Call == "Build") { GUI.Label(new Rect(100, 100, 50, 50), "Road")); GUI.Label(new Rect(150, 100, 50, 50), "House")); } }
This is a fairly close example of what I need, but I cannot get it to work. I might get it to work if I jammed them all in the OnGUI command, but I saw it was possible to draw them out of the OnGUI command in other unity answers questions. I was curious as to what I am missing. Thanks for all of your time.
A good way to get help is to format your code so that people can read it.
Answer by beco13 · Sep 21, 2011 at 04:58 AM
One suggestion of many...You can always sets a boolean to mark when something comes up...
or you can use GUI.Toggle
Your answer

Follow this Question
Related Questions
A node in a childnode? 1 Answer
GUI Label on GameObject Problem 1 Answer
GUI Chat. Why does chat message go to the next line after name? 1 Answer
Create big city for car game? 2 Answers
Gui label variable as a string.. 1 Answer