Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

How to pass a float value from another script?

$
0
0
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.

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>