I have a shooting game and I want to have the enemy stop shooting multiple seconds after becoming invisible so maybe creating like a in game timer and if >5 cancel invoke and restart on visible. In simpler term I want to wait for x number of seconds before cancelling invoke.
void OnBecameVisible(){
InvokeRepeating (“CreateBullets”, ShootTime, ShootTime);
ShootTime = T.Next(2,4);
}
void OnBecameInvisible(){
CancelInvoke (“CreateBullets”);
}