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.
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?