Hello Guest

Author Topic: RadioButton toggle  (Read 3992 times)

baph

  • Newbie
  • *
  • Posts: 2
    • View Profile
RadioButton toggle
« on: April 16, 2014, 06:27:26 pm »
Hi there,

I am using the Checkbox prefab as RadioButton and have 2 of them. Obviously I want only one of them to be active at any given time. However, it simply does not want to work.

I have 2 RadioButtons:
- RadioButtonMale
-- 'On' by default
-- On State GameObject is himself
-- Off State GameObject is 'RadioButtonFemale'

- RadioButtonFemale
-- On State GameObject is himself
-- Off State GameObject is 'RadioButtonMale'

I tried using the On & Off State combo, but this won't work as I have to click each Radiobutton twice to change it from inactive to active state for no reason.

I've run the debugger and tested this step by step. The weird part: when debugging it works like it should and like I want it to. But if I don't debug step by step, it does not work. I really have no clue what the hell is going on.


« Last Edit: April 17, 2014, 01:53:58 pm by baph »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: RadioButton toggle
« Reply #1 on: April 17, 2014, 03:02:22 am »
I have absolutely no idea whats going on as well, as you could have wired this up in a near infinite number of ways. Please post a repro case if you want me to look at it, otherwise take a look at the radio button example in UI demo #1 - the tk2dUIToggleButtonGroup behaviour handles the exclusiveness of the 3 buttons.

baph

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: RadioButton toggle
« Reply #2 on: April 17, 2014, 02:05:53 pm »
I was unable to get it to work when debugging, however I recorded the problem in a new clean project: http://youtu.be/b4q7DRaIJ8E

Edit://
I checked out the demo scene, dunno how I could've missed it. I just had to add the UIToggleButtonGroup script to the parent, now it works like a charm. I also don't have to use 'Off State GameObject' for this. Thanks!
« Last Edit: April 17, 2014, 02:23:14 pm by baph »