- Home /
Toggles ToggleGroups highlighting problem.
Case #1
A togglegroup with 3 toggles. Using normal and highlighted background images to show .isOn state of toggles. (Not using checkbox). When I click each toggle the toggles behave as expected with .isOn toggle showing highlighted color. However, this only happens after the first click and I need to show the correct colors for toggle states at Start.
I have tried: Turning toggle on using .isOn = true at start. =No effect. Using .Select() this works with 'one' toggle group, which brings me to:
Case #2 With two toggle groups, despite the .isOn state for each separate toggle group assigned correctly on clicking, only one toggle in the scene has a highlight color.
I have tried not using .Select() , but still get the same result.
I can't find this addressed anywhere on forums, so any ideas gratefully received, thanks
Answer by HuldaGnodima · Nov 11, 2021 at 08:51 PM
I just found your post here, and I wish someone had replied! Did you ever find a solution? I'm having the same issue now (needing the toggle to be selected on Start)
Edit: In case someone finds this in the future, I found this thread that goes more into depth on how the toggles work: https://forum.unity.com/threads/solved-clicking-anywhere-outside-a-toggle-deselects-it.473150/
It seems many choose to make a custom script to override the standard toggle-behaviour (it will deselect when you press anywhere else, and therefore deselect when you press in another toggle-group as it counts as "outside"). I think I will choose a solution where I'll code my own custom button-behaviour like some in that thread suggest.
Your answer
![](https://koobas.hobune.stream/wayback/20220612154620im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How To Get UI Button To Stay In A Pressed State 1 Answer
How do I highlight multiple buttons at once? 1 Answer
Buttons on mobile activating OnHighlight Animation without touching them. 0 Answers
Highlight button via script at runtime 5 Answers
How to handle button highlighted state on Android with touch/mouse/controller? 0 Answers