Author Topic: set radiobutton with scripts  (Read 2191 times)

cheerbase

  • Guest
set radiobutton with scripts
« on: May 22, 2012, 01:59:45 AM »
I use several UICheckboxs to form a Radio Group.Everything is perfect.
But how can i choose a specify checkbox with scripts?
« Last Edit: May 22, 2012, 02:12:01 AM by cheerbase »

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: set radiobutton with scripts
« Reply #1 on: May 22, 2012, 02:17:20 AM »
I am not quite sure if this will answer your question, but you can get at a specific IUCheckBox if you have many by doing the following:-



        UICheckbox[] checkbox_list = TheMenuObj.GetComponentsInChildren<UICheckbox>();

        foreach (UICheckbox checkbox in checkbox_list)
        {
            if (checkbox.name == "My CheckBox Name")
            {
                // Do something
            }
        }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: set radiobutton with scripts
« Reply #2 on: May 22, 2012, 09:03:22 AM »
And remember, UICheckbox.current will always tell you the checkbox that fired the event in your OnActivate function calls.