Substitute for WaitForSeconds

Is there a way to substitute WaitForSeconds() in update. As far as I know update does not support it. Please help.

Here is the code:

void Update() {

	if(gameObject.SetActive(false)){

		yield return new WaitForSeconds(5);
		transform.position = new Vector3(Random.Range (-35,35), 2, Random.Range (-55,17));
		gameObject.SetActive(true);
	}
		      }

Thank You,
-SK

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..
    }
    
    }

Hope this may help you.
Nsks