Unity Community


Results 1 to 7 of 7

Thread: Radio buttons


  1. Posts
    88

    Radio buttons

    I would like to make a radio button control out of multiple toggle controls. However, since each of the toggle controls are independent of each other you can select multiple ones, I only want the user to be able to select one at a time.

    I know I can do this with brute force in scripting by storing the last state of the toggle, testing for change, and setting all the others to false, but there should be a better way.

    If my description of a radio button is confusing here is a wikipedia link. http://en.wikipedia.org/wiki/Radio_button


  2. Posts
    94
    you can use SelectionGrid with toggle style to realize it.
    Code:  

    or ToolBar is also Ok


  3. Posts
    88
    Thank you, works great!


  4. Location
    Chatsworth, CA
    Posts
    144
    [quote="unitymatrix"]you can use SelectionGrid with toggle style to realize it.
    Code:  

    I also have the same question. The problem is my toggle buttons each have their own styles with graphical up / down states. Can I do this with GUILayout.SelectionGrid or do I need some tricky code to do it with GUI.Button?

    I have it working except that only the unselected radio buttons should respond to mouse clicks. Currently all of the buttons respond.

    Thanks,

    Brian


  5. Location
    Chatsworth, CA
    Posts
    144
    Actually, I got it without SelectionGrid. The code isn't that tricky


  6. Location
    Greenwood, AR
    Posts
    191
    I can't believe i fiddled farted with this for hours, when "unitymatrix" had the perfect solution!

    Thanks!

    -Raiden
    Quote: It doesn't matter if we win or lose, it's how we make the game!

    Mobile Releases:
    Ultra Line Software

    Tutorials:
    C# Audio Manager
    C# Pathfinding + txt + iTween
    C# 2D Snake Clone
    Scene Transitions

    Contact:
    Larry Pendleton


  7. Posts
    3
    append: you should also check this, just to be sure how to manage the selected item
    http://docs.unity3d.com/Documentatio...ctionGrid.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •