Setting a button noninteractable then interactable in script

I am creating an idle game, and in this code I am trying to make it so the button starts out noninteractable, but changes to interactable once the cost is reached. I’m new with this, so sorry if the answer is obvious. Here is the code in C#:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class UpgradeManager : MonoBehaviour {

    public Click click;
    public UnityEngine.UI.Text itemInfo;
    public float cost;
    public Button UpgradeButton;
    public int count = 0;
    public int clickPower;
    public string itemName;
    private float baseCost;

    void Start() {
        baseCost = cost;
        UpgradeButton.interactable = false;
    }
    
	void Update() {
		itemInfo.text = itemName + "

Cost: " + cost + "
Click Power: +" + clickPower;
}

	public void PurchasedUpgrade() {
		if (click.food >= cost) {
		    click.food -= cost;
			count += 1;
			click.foodperclick += clickPower;
            UpgradeButton.interactable = true;
	    }
	}

}

Here is a pic if it helps:
57222-help.png

I don’t see any problem here. Maybe you’re not calling the PurchasedUpgrade() method? If this doesn’t work maybe you can try disabling and enabling the object using GameObject.SetActive(false) and GameObject.SetActive(true).