private IEnumerator PopulateKeyItemPanel() { foreach (Transform child in keyItemGrid) { Destroy(child.gameObject); } foreach (KeyItem k in keyItemList) { yield return(null); GameObject slot = Instantiate(shopButton_prefab, keyItemGrid); Button btn = slot.GetComponent <Button>(); btn.onClick.RemoveAllListeners(); SetupSlot(k, slot, btn); yield return(null); if (PlayerManager.playerData.GetIfKeyItemBoughtById(k.GetID())) //Should combine with the below else if statement and make the button uninteractable { btn.onClick.AddListener(() => { shopMenu.SelectAlreadyBought(); }); } else if (PlayerManager.playerData.GetMoney() < k.GetPrice()) { btn.onClick.AddListener(() => { shopMenu.SelectNoMoney(); }); } else { btn.onClick.AddListener(() => { shopMenu.SelectItem(k); }); } } }