Subtraction Error
I have two scripts, One script is the main controller that holds all the main variables (in this case the Money Variable). The Second Script reacts to ui.button
Script one (CompanyMangaer):
public static int Capital = 50000;
....
void Update () {
capitalTXT.text = ("Capital : $" + Capital);
}
Script Two (ActionCntroller)
Scout_Btn.onClick.AddListener (()=>{
Talent_Map.SetActive(true);
CompanyManager.Capital -= 10000;
});
Normally this would work but when I try and subtract the 10,000 from the 50,000 the gui and the variable in the inspector give off a weird number like so (-6550000) I changed the number from 10000 to 10 and the capital variable was subtracted by 3,330 instead of 10.
a bit confused as to whats going on if someone can please help me it would be greatly appreciated!
Below are some screenshots of the error that occurs all I do is click the button on the screenshot once and give me that value...
Your answer
Follow this Question
Related Questions
Instantiate a script into an instantiated prefab 3 Answers
How To Save Serial Port Data to a Variable? 2 Answers
Get value from another script 1 Answer