I am trying to learn Unity by making a simple clicker game. I have made a clicker to increase your click count which works fine and have tried to make a click power upgrade which does not work.
I am also new to C sharp so I have stored all of my variables in another script called Variables.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Variables : MonoBehaviour
{
    public int Clicks;
    public int ClickPower;
    public int ClickPowerUpgradeCost;
}
This is the code in UpgradeClickPower.cs:
using System.Collections.Generic;
using UnityEngine;
public class UpgradeClickPower : MonoBehaviour
{
    public Variables vars;
    
    public void Upgrade()
    {
        vars.ClickPower += 1;
        vars.Clicks -= vars.ClickPowerUpgradeCost;
    }
}
And this is the error message I receive whenever I try and use the upgrade button:
NullReferenceException: Object reference not set to an instance of an object
I am aware this means something I'm trying to use is returning a null value but I don't know what it could be since everything in variables.cs has a value.
Also I am very new to this so if you have anything to say about my poor coding/understanding please feel free to tell me what I'm doing wrong/ineffectively.