Basically i was following a tutorial and i checked if i did the right things
heres my code
private void InitShop(){
//make sure we assigned the references
if (colorPanel == null || trailPanel == null){
Debug.Log ("You did not assign shop/trial color in the inspector");
}
//for each children transform under our color panel, find the button and add on-click
int x = 0;
foreach (Transform t in colorPanel) {
int currentIndex = x;
//error here
Button b = t.GetComponents<Button> ();
b.onClick.AddListener (() => onColorSelect (currentIndex));
x++;
}