Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Is there a way I can run a function or update score just once without using update function?

$
0
0
For Example.

int score = 0;
private bool missionSuccess=false;

private void Update()
{
Setvalue(5);
}
private void Setvalue(int value)
{
if(missionSuccess)
score += value;
}[/code]


if missionSuccess= true then the score will dramatically the value of the score every frame. What if I just want to add once when the bool missionSuccess turns true? can it be possibly solved by using delegates or event systems?

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



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