I have been trying to refill in game lives with a timer, but whenever I leave a view and return, the timer duplicates and becomes faster. I have tried to address this with the Timer?.isValid
function to only run the timer when it is invalid so it never duplicates, but it cannot seem to check is the timer is invalid in an if statement.
This is the if statement that I have been using so far:
if (myTimer?.isValid){
} else{
//start timer
}
Any help would be appreciated, thanks.