Unity new GUI, how to nicely trigger grouped toggleButton callback

Hi,
I have issues when connecting a function into On Value Changed callback :

I have a Panel, with a “Toggle Group” component, which contains two toggleButtons, that work exclusively.

In each toggleButton, I can plug a function with (only?) one argument, and what I did is put an int to notify an index of the user choice (bad design?).

But I see that the function is triggered twice, one for the old active toggleButton (for disabling event I imagine), and next for the new ticked one…
It is bad for me, because all my logic further is executed twice.

Worse, if I put a gameObject as argument of the callback function, I will not be able to put an int for index, so I will not be able to know the user choice… (.IsOn is true for Both callback executions)

So, how can I nicely trigger (the same) function from a grouped toggleButton, and know what gameObject is ticked (and only once per user click)

Thank you !

Anyway, I managed to do it in a tricky way :

// From public properties, MyPanel is the panel which contains all the grouped toggleButton:
// Each toggleButtons are connected to the function "OnToggle_Language", with a unique index for each as int parameter

public void OnToggle_Language(int _LanguageIndex)
{
	GameObject EventSource = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;

	Toggle[] Toggles = MyPanel.GetComponentsInChildren<Toggle>() as Toggle[];
	for (int i = 0; i < Toggles.Length; i++) 
	{
		if( Toggles*.gameObject ==  EventSource)*

_ if(Toggles*.isOn)_
if(i==LanguageIndex)
_
Debug.Log (i + “is trigerred”);*

* }*
}
Now, the log is only triggered once, but I’m quite sure that this is a bad workaround and there’s a cleaner way…

Maybe the better way is this(attach this to toggle group object) :

 public void OnAnyToggleValueChanged()
 {
    	var toggleGroup = GetComponent<ToggleGroup>();
    	if (toggleGroup.AnyTogglesOn()) {
    		var activeToggle = toggleGroup.ActiveToggles().First();
    		// Do something with active toggle
    	}
 }