Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 /
This question was closed Aug 11, 2015 at 07:32 AM by thornekey for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by thornekey · Aug 11, 2015 at 04:44 AM · c#unity 5ui

Unity 5 UI Menus

Hi, Im new to Unity 5 and I have made these two panels. I want it the first is only visible, and when you press the register button the 2nd panel pops up and the first one disappears.

alt text

How can I do this via C#? So much has changed since the old legacy UI workflow.

ex.png (39.3 kB)
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

2 Replies

  • Sort: 
avatar image
2

Answer by Hellium · Aug 11, 2015 at 07:18 AM

A very simple way to do this is using the OnClick() delegate directly from the inspector :

alt text

Click the + in the bottom of the box. Drag & drop the registration panel. Then chose the "Game Object > Set active) in the drop down list, and do not check the check box ! For the back button, do nearly the same with the main panel.

Comment
Add comment · Show 1 · 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 thornekey · Aug 11, 2015 at 07:30 AM 0
Share

Great solution! Thanks

avatar image
0

Answer by rajavamsidhar_gvs · Aug 11, 2015 at 05:41 AM

I'm not pretty much familiar to u5 UI.But you can use booleans with enabling and disabling for this.like

  public GameObject Login;
         public GameObject Register;
     bool a;
     bool b;
         
         void Start(){
     a=false;
     b=false;
         Login=GameObject.Find("Login");
         Register=GameObject.Find("Register");
         }
         void Update(){
         //button Register OnClick event
 a=true;
     if(a&&!b){
         Login.enabled=false;
         Register.enabled=true;
         
     }
         //button back OnClick event
 b=true;
      if(b){   
         Login.enabled=true;
         Register.enabled=false;
 a=false;
     }
         }

Once see this tutorial Link

Comment
Add comment · Show 3 · 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 Hexer · Aug 11, 2015 at 06:39 AM 0
Share

This is not how you use booleans in c# Unity. Your script is full with problems.

avatar image thornekey · Aug 11, 2015 at 06:52 AM 0
Share

I agree, @Hexer, this is not the correct solution.

avatar image rajavamsidhar_gvs · Aug 11, 2015 at 07:05 AM 0
Share

sorry i edited my answer..

Follow this Question

Answers Answers and Comments

26 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Cronómetro 1 Answer

Bool condition is always resulting in false even when it seems impossible to be false even using debug lines to check 4 Answers

Unity 5: UI button OnPointerDown not function as expected 1 Answer

Add Listeners to array of Buttons 2 Answers

Display spinning icon while some search method in progress ? 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