How to give Parameters to Button Events via script?

I try to get a Button prefab working. My only problem is, that I can't call the function I wan't to call. I want to call a function which needs the text of the button as parameter. So now I wanted to use OnClick.AddListener(method) but like that I'm unable to send parameters I can only call a function without any parameters. I'm using c# btw.
Any suggestions?

My Button binder script wraps around the button's AddListener method. When the button is pressed, the binder handles the event and calls the target method. If I have a parameter, I pass that along for the ride.

1 Like

like nventimiglia says you can wrap this when you make the call.

Something like:

myButton.AddListener (delegate { myFunction (myButton.text);});