It doesn’t seem to be a good idea to wait in the Update method. If you want something to be done after n seconds, start a coroutine and do “yield return new WaitForSeconds(n);” there instead.
" yield return new WaitForSeconds(5);" this can only be used under coroutines.
If you really wanted to wait for second in update method try using below work around(Untested but should work)
float UserTimer;//which has running seconds
void Update(){
UserTimer+=Time.Deltatime;
if(UserTimer>2)//which means if usertimer variable crosses value of 2{
print("2 seconds completed");
//do your stuff
UserTimer=0;//make this variable 0 to again trigger this loop and so on..
}
}