I am using the new UI and attempting to toggle a button state to ‘On’ or ‘Off’. I have experimented with both Event.current.SetSelectedGameObject and in using a Toggle component to switch out versions of the same button. Using the Event engine produces no discernible results, and the Toggle node seems to reveal the second Button without offering it’s interactivity.
Is there a simple way to set a button to ‘Pressed’ and leave it down? I can understand how the Event engine might overwrite changes on subsequent frames, but I don’t understand why there are no controls of this sort exposed through the UI.
Is there a way that I can use the current tools to achieve what I am after? Ideally, I would like to Toggle two buttons with different graphics, but I could accept a scripted approach. Perhaps adding another button event script?
I’m not sure if it is a bug, but the Toggle UI item didn’t seem to be responding to the swap-sprite animation at it’s root.
try creating a toggle control from the create menu instead of adding the toggle component from the add component menu because a full toggle control consists of multiple components and game objects
Thanks for the code snippet. The toggle was added using the create menu, but I was using a beta version of Unity 5, and I am going to rebuild the project in 4.6.1 and see if it isn’t an issue in the implementation.