I am trying to create a powerup system in my game right now and the way that I have set it up is if the player passes through an object a number will increase by 1. And after the player passes through this object 4 times the powerup will get enabled. What I am trying to add to this is when the player passes through the object once the number gets set to one after a certain amount of time passes without the player going through the object again the number goes down by 1. If the player goes through the object before the timer reaches 0 then the number should go up by 1 again. This is what I have tried.
while(comboNumber >= 1)
comboNumber -= 1;
yield return new WaitForSeconds(1f);
All that is happing from this is the comboNumber is never going up. It always stays at zero. I have tried adding a bigger delay but the comboNumber never seems to go up. The while loop is in the update function. If anybody has any suggestions that would be great!