Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by AirMotionz · Feb 25, 2014 at 09:45 PM · c#guigui-button

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AirMotionz · Feb 25, 2014 at 09:53 PM 0
Share

No like if I click this Gui Button on my screen a new one will appear somewhere.

avatar image RudyTheDev · Feb 25, 2014 at 10:11 PM 0
Share

That's pretty much what it does. You click the first button, a second one appears. Do you need >1 to appear?

avatar image AirMotionz · Feb 25, 2014 at 10:15 PM 0
Share

Sorry im kinda a newb and creating an inventory system. Is there any way to make this more simplistic?

avatar image RudyTheDev · Feb 25, 2014 at 10:17 PM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges