- Home /
Other
Cash per second rapidly going up
if(coalMine >= 1) {
cashPerSecond += coalMine;
}
I have this, but now every few miliseconds my cash per second goes up by one which increases my cash alot. I just want it to go up ONCE! Not all the time, I want it once. Thank you -Ryan
I assume this is being called in update? Try moving it to a different function and calling that function once, when you want it to increase. I don't know your setup but alternatively you might be able to do:
while(coal$$anonymous$$ine > 0) {
cashPerSecond ++;
coal$$anonymous$$ine --;
}
or similar
Answer by kacyesp · Aug 29, 2014 at 06:25 PM
if(coalMine >= 1) {
cashPerSecond += coalMine;
coalMine = 0;
}
Now the if statement will be false in the next Update/FixedUpdate call.
Ah, don't worry, it's been solved, just needed a ++, but thanks :)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
augmented reality 0 Answers
Preserving the custom inspected Target object between play states 0 Answers
In the need of the light of a genius ! 2 Answers