Hey guys! I am setting up an item shop for my game. I'm trying to create it completely from scratch using the skills I have learned so I haven't been watching a tutorial or anything like that so sorry if this is not the best way to go about this problem.
So I have an item shop where each button has a script attached that stores information like the cost of the item, the name, if its been unlocked, etc.. That script is unique to each button as I haven't hardcoded anything other than the variable names.
I then have a a game object that is the parent of all these buttons that has the main ItemShop Script that I will be referencing.
When a button is pressed, it access the parent game object that has the script attached and it calls the BuyItem() function. inside of that function. inside that function I try to acesss the cost and the name of the item. Again this information is inside the ItemShopInfo.cs script.
My question is, how do I, when pressing a button, call the BuyItem() function and tell it certain variables from the ItemShopInfo.cs script.
Here are some pictures in case my explanation is bad.