Quantcast
Channel: Answers by "lodendsg"
Viewing all articles
Browse latest Browse all 102

Answer by lodendsg

$
0
0
fafase answer should be what you need you can also do this inline with fewer variables as //where score is int score; score = (int)(Time.time+0.5f); the cast will simply trim the decimal off so first we want to incress the value by .5 such that 2.5 becomes 3 while 2.4 becomes 2.9 because (int)2.9f = 2 Also since you are creating a score based on the number of seconds since X you could avoid a few pointless calls and perform the calculation elsewhere as opposed to on Update i.e. void Start() { InvokeRepeating(CalculateScore, 2, 1); } void CalculateScore() { score++; }

Viewing all articles
Browse latest Browse all 102

Trending Articles



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