Hello! In short, I need to create a Toggle Group, but my own, because Toggle Group Unity has flaws.

This is my main Toggle Group script.

And this is the script that is in all Toggle-ah. It contains the ID Toggle.

In the beginning, I give each Toggle my ID.

Then I do it so that when I click on Toggle everyone disconnects and it turns on.

And I get such a masterpiece.

I realized that the error was due to this line, but what is wrong with it.

Here is the script 1

public int id; TogglesGroupScript togglesGroupScript;

/* ==================================== Start =====================================*/ private void Start() { togglesGroupScript = GameObject.Find("Scene Settings").GetComponent<TogglesGroupScript>(); } /* ==================================== Update =====================================*/ private void Update() { Toggle toggle = gameObject.GetComponent<Toggle>(); toggle.onValueChanged.AddListener(delegate { togglesGroupScript.value = id; togglesGroupScript.SelectTool(id); }); } 

This script 2

public int value; public Toggle [] Toggles;

 /* ==================================== Start =====================================*/ private void Start() { for (int i = 0; i < Toggles.Length; i++) { Toggles[i].GetComponent<ToggleOfGroupScript>().id = i; } } /* ==================================== Functions =====================================*/ public void SelectTool(int id) { for (int i = 0; i < Toggles.Length; i++) { Toggles[i].isOn = false; } Toggles[id].isOn = true; } 

Mistake:

 StackOverflowException: The requested operation caused a stack overflow. UnityEngine.MonoBehaviour.StartCoroutine (IEnumerator routine) (at C:/buildslave/unity/build/Runtime/Export/MonoBehaviour.bindings.cs:90) UnityEngine.UI.CoroutineTween.TweenRunner`1[UnityEngine.UI.CoroutineTween.ColorTween].StartTween (ColorTween info) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Animation/CoroutineTween.cs:232) UnityEngine.UI.Graphic.CrossFadeColor (Color targetColor, Single duration, Boolean ignoreTimeScale, Boolean useAlpha, Boolean useRGB) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:609) UnityEngine.UI.Graphic.CrossFadeAlpha (Single alpha, Single duration, Boolean ignoreTimeScale) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:621) UnityEngine.UI.Toggle.PlayEffect (Boolean instant) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:207) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:186) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:29) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:163) UnityEngine.UI.Toggle.set_isOn (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:157) TogglesGroupScript.SelectTool (Int32 id) (at Assets/Scripts/New/All/TogglesGroupScript.cs:27) ToggleOfGroupScript.<Update>m__0 (Boolean ) (at Assets/Scripts/New/All/ToggleOfGroupScript.cs:26) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (Boolean args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Boolean].Invoke (Boolean arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Toggle.Set (Boolean value, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:190) UnityEngine.UI.Toggle.Set (Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs<message truncated> 

Help me what to do? Need any solution.

  • See the code is not in the screen, and the text. The mistake is that you catch the change event and change the values ​​in it, causing the event again and again (but this is not certain, I did not consider the hidden values ​​do not increase) - Valera Kvip February
  • Well, or transfer the code from Update to Start, because you hang on the listener every frame .... - Valera Kvip February
  • @ValeraKvip changed the question here are both scripts - Alt F4 1:31 pm
  • To add a colbek each frame is strong. - RiotBr3aker
  • Ok, tried to do what I wrote on the solution? - Valera Kvip 1:34 pm

1 answer 1

Maybe I misunderstood the code, but what question is this ...

 /* ==================================== Start =====================================*/ private void Start() { togglesGroupScript = GameObject.Find("Scene Settings").GetComponent<TogglesGroupScript>(); Toggle toggle = gameObject.GetComponent<Toggle>(); togglesGroupScript.value = id; } /* ==================================== Update =====================================*/ private void Update() { // Не нужно каждый кадр добавлять слушатель. Потому что это очень скоро сломает приложение } 

Likely cause: endless recursion

 Toggle toggle = gameObject.GetComponent<Toggle>(); toggle.onValueChanged.AddListener(delegate //<-- значение изменилось принять событие. { togglesGroupScript.value = id; togglesGroupScript.SelectTool(id);// <-- значение изменилось, кинуть событие }); 

What to do: do not use the event, but why do we need it here at all ... And never change the value in the listener who is listening to the change of this value!

  • Yes, I shot the event, but how can I understand when the user changed the Toggle? Here is my question - Alt F4
  • Add an event only to the desired one (the main one, the one that disables all the others) togl. And you added to everything. And never change the value in the listener who is listening to the change of this value. The error is the most common, the implementation of togl groups is beyond the scope of the question. PS: are you sure that the standard group trademark has disadvantages compared to yours ... in this context. - Valera Kvip pm
  • Well, I tried to get the ID of the clicked togl in the standard togl-group but could not. I got anything but an ID. - Alt F4
  • Well, why do you need an id? Especially since there is none. - Valera Kvip pm
  • Id in order to understand what tool the user wants to use and what exactly does not bother me still. - Alt F4