Quantcast
Channel: Questions in topic: "twice"
Viewing all articles
Browse latest Browse all 70

Unity new GUI, how to nicely trigger grouped toggleButton callback

$
0
0
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 !

Viewing all articles
Browse latest Browse all 70

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>