- Home /
Question by
piecewise13 · Jun 21, 2017 at 07:23 PM ·
c#time.deltatimedeltatime
Setting a float to delta time then to 0 only working once
I have a void that is being called multiple times: this is what it looks like
if ((team2Score >= maxScore) && (team1Score - team2Score >= winByValue | team2Score - team1Score >= winByValue)) {
seconds += Time.deltaTime;
e = e + 1;
if (e == 1)
{
team2GamesWon = team2GamesWon + 1;
}
if (seconds > 3)
{
e = 0;
seconds = 0;
This only works the first time and then after that seconds only goes to 0.3. Anyone know why?
Comment
Will probably need more code than that. It seems likely that either the first large if condition is just co$$anonymous$$g up false, the function is not being called properly, or some code somewhere else is changing the value of seconds.