Quantcast
Channel: Answers for "[4.6 - UI] Calling function on button click via script"
Viewing all articles
Browse latest Browse all 6

Answer by Aztec

$
0
0
I was stuck at a similar problem recently. I had multiple buttons added via script and each of them should call a function with another parameter. There was a lot of trouble because everytime only the last button in the list called the function instead of the other one i really wanted to. So my trick was to add a short script (only with my listener and the variable) to each button Prefab. So if the buttons are created there is no Problem with the sharing of the listeners. I hope i could save someone a little bit of time ^^

Viewing all articles
Browse latest Browse all 6

Trending Articles



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