Get value in button OnClick()


I’m developing an RTS which has buildings that the player has to first unlock before they can be placed. I’m alright with having the buttons that construct those buildings visible but I want them to be non-interactive.
The way I’m using the buttons is that in each I use the OnClick() to call a function in a script and pass the gameobject to be constructed, which I set in the inspector.

Basically I want to have a button manager script where I check for each button whether the gameobject assigned has a specific parameter, is it possible for me to do that?

ok. the should be:

foreach (var b in buttons){
  GameObject target = b.ButtonClickedEvent.GetPersistentListener(0) as GameObject;

this works for one receiver on each button. if there’s more you’d need to loop the function.