Quantcast
Channel: Questions in topic: "temporary"
Viewing all articles
Browse latest Browse all 97

make good way to call function from update

$
0
0
Well here is a script where i try to add an effect to game that makes player see how score is added.... There is only one way how to add to real score - using tempScore which is temporary score where all numbers are stored if an event has happened. My question: is there a way to make this work with better performance and as a better visual effect for potencial player? Thanks for support! Code goes here: function Update() { if(tempScore<=0) { if(tempScore<0) tempScore=0; scoreNumberTxt.text=""+score; tempTxt.text=""; } else { AddScore(); } } function AddScore() { while(tempScore>0) { scoreNumberTxt.text=score+""; tempTxt.text="+"+tempScore; yield WaitForSeconds(0.35); tempScore--; score++; } }

Viewing all articles
Browse latest Browse all 97

Trending Articles



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