Can i use 2 buttons or many more with one function?

Hi, there i am trying to create a function onClick with 2 or more buttons who call from it, a flaot or int.How can i do that.I succeeded with 2 functions and 2 buttons but i need in public void ClickLevel () to have many buttons attached with a number for int.Because with int i make custom object and i need every button to have different number.

You would just add a parameter to your function and then feed the parameter through the buttons.

So your ClickLevel() would be

public void ClickLevel(int level)
{
    Debug.Log("Clicked level: " + level.ToString());
}

In the inspector when you assign the button functions, you can assign the int of the level.

You would just add a parameter to your function and then feed the parameter through the buttons.

So your ClickLevel() would be

public void ClickLevel(int level)
{
    Debug.Log("Clicked level: " + level.ToString());
}

In the inspector when you assign the button functions, you can assign the int of the level.