Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

ToggleGroup doesn't work = Bug?

Discussion in 'UGUI & TextMesh Pro' started by elmar1028, Nov 4, 2014.

  1. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    Hi guys,

    While trying out the new Unity 4.6, I was stuck with toggle group component.

    Basically it just doesn't work. I have created a new gameobject and add a toggle group component to it. I have assigned a group to all toggles, but it works like they're not related to each other.

    I have tried creating toggle group outside canvas and still I have same issue.

    Documentation on new Unity UI is poor in content (including toggle group).

    Any ideas?

    Thanks in advance!
     
  2. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Switch to b20. They got broke in b21.
     
  3. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Toggle groups work in b21 but there does seem to be a bug where if the GameObject of the Toggle or ToggleGroup is set to inactive, the references to the ToggleGroup are made null. As a workaround, I re-register the ToggleGroup whenever I reenable the panel the Toggles live on (and the ToggleGroup was moved to a GameObject that is never made inactive)

    Code (csharp):
    1. exampleToggle1.group = exampleToggle2.group = exampleToggleGroup;
     
  4. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    Assign the toggle group for every toggle in "OnEnable" method instead of static reference.
     
  5. Suminsky

    Suminsky

    Joined:
    Aug 11, 2011
    Posts:
    50
    So, Im having that problem with unity 5.1, and not even setting the group by code is working.. It turn the toogle button off doesnt matter where you click, doesnt matter which button you click (dont need even to be a toogle), even with the 'allow switch off' unchecked...
    The 'is on' check box only works if you have a checked image also..
     
  6. Prosto_Lyubo

    Prosto_Lyubo

    Joined:
    Aug 15, 2013
    Posts:
    8
    Do You add Your Toggle Group component to Your toggle components?
    In the inspector of a Toggle it is just above OnValueChanged Event and the variable is called "Group" - just drag there game object from hierarchy which has the Toggle Group components. That way You can bind Toggle Element to different Toggle Groups.