I’ve been working on a simple clicker game and I want to make an upgrade button that is not interactable if a float value of the price in the button is greater than the float value of gold you have. Here are the important bits of my code:
The first script has the float value of gold
public float gold = 0.00f;
The second one has a public float of the upgrade cost that is later assigned a value. It’s supposed to compare the cost float in script #2 to the gold float in script #1 in an if statement and I have no idea how to link the float value from script #1.
public float cost;
void Update(){
if (cost > gold)
buyitem.interactable= false;
else
buyitem.interactable = true;
Thanks in advance and sorry if what I’ve written is unclear.