how can i add condition on no of frames in update function???

I have an issue regarding frames if someone can help me out in that
I want to add a condition in update that if frames are incremented to 30 call a function
I am stucked on this
I even use StartCoroutine() so that it can wait for 20 seconds but still its not working
I am using this code in update()
public bool frames = true ;
public int counter = 0;

void Start () {

void Update(){

	int frameNos = Time.frameCount;
	if (frameNos == 30) {

		if(counter == 30){
			Debug.Log (counter);
			testFunction ();
			counter = 0;


What condition should i add so that my counter counts next 30 frames and so on …

Please help
Any help will be appreciated.
Thanks in advance

The modulo operator is useful for things like this. It does a divide and returns the remainder. So something like x % 30 will divide by 30 and return the remainder, which will always be between 0 and 29.

void Update()
    if (Time.frameCount % 30 = 0)
        // do your stuff every 30 frames

The remainder will be 0 every time 30 divides evenly into frameCount. Of course, this will also happen on the very first frame too so you would need to deal with that - possibly by comparing the remainder to 29 instead (which would be the 30th frame since we start with 0).