New UI button OnClick() how to "send message" with parameters?

I have try different ways to send message with/without brackets, commas and different combinations to seperated text with parameters but couldn’t get it to work. It’d be great if there is an example but I wasn’t able to find it in the refereces.

You might have to zoom in with ctrl + mouse scroll wheel to see the picture, but its just a string with nothing special about it.
it calls this script:

public void Testing123(string buttonName)
		Debug.Log (buttonName);

and that makes it work just fine.

Also the function must be public and void, and have one or no parameters.
For the parameters you can use float, int, string, bool, or a Unity Object.
This is a very nice video to help understand almost everything about the new UI buttons.

Hopefully This will Help You.If you want to pass the parameters through the inspector, Then make them as the public variables in the script in which the function which calls when the button is present.

public class ButtonScript : MonoBehaviour {

    public string message;
    public int integer;
    public float floatingPointNumber;

	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {

    public void ButtonPressed()
        //Do Whatever You Want
        Debug.Log("Message: " + message + "	" + "Integer: " + integer.ToString() + "	" + "Float: " + floatingPointNumber);


void InitMusicListContent()
JSONNode musicData = _myAudioPlayer.GetMusicData;

			//set the size of it before we start to fill it
			_musicListRectTransform.sizeDelta = new Vector2 (_musicListRectTransform.rect.x, _heightOfSongPanel * (musicData.Count + 2));

			// for each song in the array, create new panel--> Parent under the Content panel --> Get its components --> init them
			for (int i = 0; i < musicData.Count; i++) 
				GameObject songPanel = 
					Instantiate (_songPanelPrefab, this.transform.position, this.transform.rotation, this.transform) as GameObject;

				Text[] textComponents = songPanel.GetComponentsInChildren<Text> ();
				foreach (Text text in textComponents) 
					if ( == "ArtistNameText") {
						text.text = musicData  *["ArtistName"];*
  •  			} else if( == "TrackNameText"){*

_ text.text = musicData [“TrackName”];_
* }*
* }*

* Button songPanelButton = songPanel.GetComponentInChildren ();*

* // must assign it to a variable before supplying it to listener*
_ string x = musicData*[“TrackPath”];_
songPanelButton.onClick.AddListener(() => {myAudioPlayer.AddToMusicQueue(x);} );*
* }
So i was working on some music streaming in a game engine and i ran into the same problem. I wanted the user to be able to choose a song to add to there music Queue while they were playing the game. Because of the sheer amount of songs to choose from, the only good way to subscribe a button to a specific method was programatically. Here, you can see that I have a loop that instantiates a prefab, and on this prefab I had a Button. I needed to subscribe this button to a method that took in a string that represented a path to the song. Because each of these are different for each song, I needed the parameter value that is passed in to be diff for each button. Initially, It didnt work because i did this:_

songPanelButton.onClick.AddListener(() => {_myAudioPlayer.AddToMusicQueue(musicData[“TrackPath”]);} );*

I tried to pass in the track path directly. Once I placed the value in a variable, then it worked.
Don’t make this same mistake. Its hard to fix.
Hope this helps. Cheers mate.