Author Topic: UICheckbox onChecked question  (Read 4334 times)

elvess

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 44
    • View Profile
UICheckbox onChecked question
« on: January 24, 2014, 06:53:07 AM »
Hello. I have 3 UICheckboxes. Each of them controls different object. When I click on checkbox, controlled gameObject is shown. How can I call different function for each of these checkboxes when I click on it.

Thank U.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICheckbox onChecked question
« Reply #1 on: January 24, 2014, 08:14:39 AM »
By setting a different function on each checkbox? I don't understand the question.

elvess

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 44
    • View Profile
Re: UICheckbox onChecked question
« Reply #2 on: January 24, 2014, 08:29:43 AM »
Yes. I want to set different function on each checkbox.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICheckbox onChecked question
« Reply #3 on: January 24, 2014, 09:21:16 AM »
So do it. :P

NGUIJeffS

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 19
    • View Profile
Re: UICheckbox onChecked question
« Reply #4 on: January 24, 2014, 11:06:24 AM »
Look for the UIToggleScript on the checkbox Object/"widget". There should be an OnChangeValue section. You'll see the "notify" which is the script that will be called when "OnChangeValue" occurs. Below the "notify" is the method (function) within the script that you want to have called. Note that you can call a chain of Notify...Method's by adding a new "notify" just below the last method selected.
Hope that makes sense.