How to i get the function caller?

so i am doing a job of implementing all Onclick functions via scripting by adding them listeners. The only problem i am currently having is that i have no way of sending the correct gameobject as a parameter.

the code below is how i am currently adding the onclick functions.

 GameObject currentButton;

        for (int i = 0; i < buttons.Length; i++)
        {
            currentButton = buttons*;*

Debug.Log("Boton " + i);
buttons*.transform.GetComponent ().*
onClick.AddListener (() => { tournamentController.getPrefScoresOfLevel (); });
//buttons*.transform.GetComponent ().*
// onClick.AddListener (() => { tournamentController.
// getLevelValues (currentButton); });
buttons*.transform.GetComponent ().*
onClick.AddListener(() => {tournamentController.ShowModal ();});

}
The only problem is that when adding the getLevelValues, the parameter updates to the last gameobject buttons that iterated through the for cycle.
the code below is the function’s code in case there is a way to make it by changing this function.
public void getLevelValues (GameObject values)
{

Debug.Log(“this function loads tournament button values to the window”);
levelName = values.gameObject.transform.
FindChild(“Name”).GetComponent().text;
Debug.Log (values.gameObject.transform.
FindChild(“Name”).GetComponent().text);
// levelImage.sprite = values.gameObject.transform.
// FindChild(“Logo”).GetComponent().sprite;

}

This problem is common, and I find that the best explanation writeup is [this one][1].

In essence, you’re already declaring a “currentButton = buttons_”, so this should be fixed by using that instead of buttons further down._
_*[1]: Log In - Confluence