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 GKdev1980 · Apr 07, 2015 at 07:55 PM · uitoggle

Unity 4.6 UI Toggle issue (start disabled)

I'm trying to migrate from NGUI to the Unity 4.6 UI system. I'm going through the official tutorials. Most of the stuff I want to do seem simple, I'm stuck with the toggle feature though.

It seems to be linked to the "enabled" state of a component. Meaning, that when the toggle is enabled, the linked functioned is enabled too and when the toggle is disabled the linked function is disabled too. There is a case where I need the opposite. Let me be more specific.

I have a single toggle, which controls 2 objects, let's call them object A and object B. The easy thing to do is enable/disable the MeshRenderer for both of them. I just drag them to the GameObject field of the OnValueChange, choose the MeshRenderer.enabled (from the Dynamic Bool section) and now when the toggle is enabled they are both visible, when the toggle is disabled they are both invisible.

Now what I want to do, is set the toggle this way, that when the toggle is enabled, A is visible and B is invisible and vice versa, when the toggle is disabled, A is invisible and B is visible.

But I can't get this to work.

Any help?

Would this be a lot easier setting 2 separate states for the toggle, enabled and disabled and setting separately what would happen in each case?

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 GKdev1980 · Apr 07, 2015 at 08:11 PM

Probably too soon (I think it took me longer to write my initial post than finding the answer -at least ONE answer- myself)..

I wrote a short custom script creating a toggle variable assigning the Toggle component to it and checking in the update for the toggle.isOn value.

So this works. I just hoped for an easier solution using the Editor directly.

Guess there isn't one?

Comment
Add comment · 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

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

18 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

Related Questions

Dont Destroy On Load for child object 1 Answer

Cursor Problem / Toggle Lock and Unlock 0 Answers

Is there a better way to access the single active Toggle in a ToggleGroup? 4 Answers

Is there a way to know when mouse is 'hovering' over a Toggle? 2 Answers

Cant access .interactable 1 Answer


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