void Start() { GetComponent <Button>().onClick.RemoveAllListeners(); GetComponent <Button>().onClick.AddListener(delegate { if (needsToUnlock != AbilityTypes.None) { bool bIsInteractable = (DataController.Instance.OwnedAbilities.Contains(needsToUnlock)); bIsInteractable = (bIsInteractable) && !DataController.Instance.OwnedAbilities.Contains(abilityType); bIsInteractable = (bIsInteractable) && DataController.Instance.CurrentPoints >= _price; _btnBuy.interactable = bIsInteractable; } else { _btnBuy.interactable = !DataController.Instance.OwnedAbilities.Contains(abilityType); } _title.text = _titleValue; _desc.text = _descValue; _btnText.text = _price.ToString(); _upgradeController.ChangeHighlight(highlight); _btnBuy.onClick.RemoveAllListeners(); _btnBuy.onClick.AddListener(delegate { _upgradeController.BuyAbility(_price, abilityType); _btnBuy.interactable = false; }); }); }