- Home /
Is there a method to create toggle group behavior for standard buttons
Developing an AR app that utilizes buttons to load groundPlane GameObjects from AssetBundles. The script associated with this uses a coroutine to manage loading. When the button is enabled, the script loads the Prefab named in the variable, and then upon OnClick, places the loaded Prefab as well as disabling the button. To insure only one Prefab is loaded at any time, only one button should be enabled at any time.
The builtin Toggle and Toggle Group are not applicable because there is not an "onClick" method. and the script is not contextually applicable.
Does anyone know if it is possible, via scripting, to emulate a Toggle Group, but for these standard UI Buttons which execute the actions described above?
Answer by Giantbean · Aug 30, 2021 at 03:54 PM
If any one else stumbles upon this old unanswered question, Using the Toggles OnValueChange() method could handle the same things as the buttons OnClick() method. Otherwise you would need write a new button group controller script to group the buttons and emulate what's already possible with a toggle and toggle group.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Access UI.Toggle from c# CodeBehind -How does one set the Toggle created in the front end of Unity? 1 Answer
Do Something ONLY when all Toggles are On or Off 4 Answers
toggle highlight script ? 0 Answers
Reset the last local players toggle button while keeping online players selection? 0 Answers