need my function to take 2 variables and show in OnClick list

I wrote a function for a set of buttons but after i wrote & built, it didn’t show up in the OnClick function list on my buttons so i looked around on google and found out that you can’t do this(no idea why though). I don’t know how to work around this problem so i’m hoping one of you guys have a good idea.

In my game i have a lot of stuff that can be bought, each item has it’s own panel and buy button which is supposed to open a different panel ment for all transactions(“shop”), this panel includes 2 price texts, 1 for each currency. So a function that takes 2 variables so i can set it differently for each button in the editor seemed like an easy and effective way to do it.

here’s the script:

public void OpenShop(int creditcost, int crystalcost){
		creditsCostText.text = creditcost.ToString();
		crystalsCostText.text = crystalcost.ToString();
		if (ShipMenu.activeInHierarchy == true) {
			panelOpened = false;
		} else {

Try this:

public void OpenShop (string item = "100,100")
    string[] split = item.split (","[0]);
    int creditcost = int.Parse(split[0]);
    int crystalcost = int.Parse(split[1]);

and when you use it:

 OpenShop ( CreditCost.toString() + "," + CrystalCost.toString() )

This might not be the best way around it.
Unity really need to support multiple variables for UI Button onClick event.

Just put the variables in an array of objects and give that array to the function

There are a couple of options provided in this question: UI Button multiple parameters