- Home /
Making a GUI button appear after pressing another GUI button? C#
Im trying to make a GUI button appear after a gui button has been pressed but i dont know how?
Answer by RudyTheDev · Feb 25, 2014 at 09:48 PM
Do you mean like this:
private bool hasMyFirstButtonBeenPressed = false;
void OnGUI()
{
if (GUILayout.Button("Enable shy button!"))
{
hasMyFirstButtonBeenPressed = true;
}
if (hasMyFirstButtonBeenPressed)
{
if (GUILayout.Button("Nah, disable me"))
{
hasMyFirstButtonBeenPressed = false;
}
}
}
More advanced versions can be made with Toggle.
No like if I click this Gui Button on my screen a new one will appear somewhere.
That's pretty much what it does. You click the first button, a second one appears. Do you need >1 to appear?
Sorry im kinda a newb and creating an inventory system. Is there any way to make this more simplistic?
Well, not simpler than this I'm afraid; not unless you get some sort of plugin from the asset store to avoid coding, but even then you can expect a decent amount of effort to get exactly what you need. I'm sure there are some free inventory scripts out there, a lot of games get started along those lines.
Your answer
Follow this Question
Related Questions
Cases if a GUI.Button is clicked two or more times?? 2 Answers
Erroe when resizing GUITextures in C# file 1 Answer
Is there any easy way to keep buttons inside of box? (c#) 1 Answer
Multiple Cars not working 1 Answer
Create a Button Scrollview 0 Answers